The Range object defaults to your ActiveWorksheet. Set myRange = Range("A1") 'Need to use Set to define myRange As the VBA Range is an object you need to use the Set statement: The Range is a separate object variable and can be declared as other variables. Select a cell or Range of cells using the Select method. Range("A1:B2").Activate 'Activate the cells and show them on your screen (will switch to Worksheet and/or scroll to this range. Range("A1:B2").Select 'Select the Cells A1:B2 in your Excel Worksheet Set r= Range(Range("A1"), Range ("B1")) 'Range of 2 cells A1 and B1 Set r = Range("A1:B2") 'Square Range of 4 cells - A1,A2,B1,B2 The Range is a Worksheet property which allows you to select any subset of cells, rows, columns etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |