Reputation: 107
I am quite new to VBA and I want to select a block of cells in an excel spreadsheet, for example, I have a block of data, and I only want to select the region wrapped in blue. Can someone advise me on how to do this? I looked into range and selection but couldn't find any good solutions. Thanks in advance.
Upvotes: 0
Views: 2184
Reputation: 1952
For completeness and to add to the responses by @Thuruv and @Alex K, also be aware that there are a couple of other options which may be useful:
Range("A1:E10").Select
Range("A1", "E10").Select
Range(Cells(1, 1), Cells(5, 10)).Select
Of particular note is the last example which although may look long-winded, it is invaluable when, for example, using loops or calculations to work with Ranges.
Upvotes: 1
Reputation: 78
Any condition on selecting those range. . ?
Use the select range code below.
Sheets("Sheetname").Activate
ActiveSheet.range("A1:E10").Select
Upvotes: 1