'You can also use Cell Object as shwon below B6:Ĭells(6, 2) = "Hello World! using Cell" 'Here 6 is Row number and 2 is Column numberĮxcel VBA Macros for Beginners- Novice Example 3: How To Change The Background Color Of A Particular Range 'Example 2: How To Enter Data into a Cell This example will show you how to write the data from VBA to Spread sheet range or cell. The following example will help you in formatting a cell or range by changing the background color of a range. 'Example 3: How To Change The Background Color Of A Particular Range We can use ColorIndex property of a Ranger Interior object to change the fill color of a range or cell. Range("B1:B5").Interior.ColorIndex = 5 ' 5=BlueĮxcel VBA Macros for Beginners- Novice Example 4: How To Change The Font Color And Font Size Of A Particular Range 'You can set the background color using Interior.ColorIndex Property You may need to change the font color of range or cell sometimes. We can differentiate or highlight the cell values by changing the text color of range in the worksheet. Range("B1:B10").Font.ColorIndex = 3 ' 3=RedĮxcel VBA Macros for Beginners- Novice Example 5: How To Change The Text To Upper Case Or Lower Case 'Example 4: How To Change The Font Color And Font Size Of A Particular Range The following method will use the font ColorIndex property of a range to change the font color. This example will help you to change the text from lower case to upper case. Range("C3").Value = LCase(Range("C3").Value)Įxcel VBA Macros for Beginners- Novice Example 6: How To Copy Data From One Range To Another Range 'You can use LCase function to change the text into Upper Case 'You can use UCase function to change the text into Upper Case 'Example 5: How To Change The Text To Upper Case Or Lower Case If you wan tot change the text or string from upper case to lower case, we can use LCase function. Range("A1:D11").Copy Destination:=Range("H1")Įxcel VBA Macros for Beginners- Novice Example 7: How To Select And Activate Worksheet 'Example 6: How To Copy Data From One Range To Another Range This example will help you to copy the data from one particular range to another range in a worksheet using VBA. This example will help you to select one particular worksheet. 'You can use Acctivate Method to activateĮxcel VBA Macros for Beginners- Novice Example 8: How To Get The Active Sheet Name And Workbook Name 'Example 7: How To Select And Activate Worksheet To activate one particular sheet we can use Activate method of a worksheet. We can use Name property of a active sheet to get the worksheet name. 'Example 8: How To Get The Active Sheet Name And Workbook Name We can use name property of active workbook to get the name of the active workbook. 2500 EXCEL VBA EXAMPLES DOWNLOAD HOW TO.
0 Comments
Leave a Reply. |