user3351901
user3351901

Reputation: 107

excel vba selecting a block of cells

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.enter image description here

Upvotes: 0

Views: 2184

Answers (2)

barryleajo
barryleajo

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

Thuruv
Thuruv

Reputation: 78

Any condition on selecting those range. . ?

Use the select range code below.
Sheets("Sheetname").Activate
ActiveSheet.range("A1:E10").Select

Upvotes: 1

Related Questions