ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   select a range using "cells()" (https://www.excelbanter.com/excel-worksheet-functions/33976-select-range-using-%22cells-%22.html)

fullers

select a range using "cells()"
 
Rather than using the range function to select multiple cells, ie:

Range("A1:B6").Select

Is there a way to use - Cells() instead. This is because the number of cells
will change.

Thanks

Bob Phillips

Range(Cells(1,1),Cells(6,2)).Select

or

Range(Cells(1,"A"),Cells(6,"B").Select

or

Cells(1,"A").Resize(6,2).Select

or ...

etc.

--
HTH

Bob Phillips

"fullers" wrote in message
...
Rather than using the range function to select multiple cells, ie:

Range("A1:B6").Select

Is there a way to use - Cells() instead. This is because the number of

cells
will change.

Thanks




Alan Beban

Bob Phillips wrote:
Range(Cells(1,1),Cells(6,2)).Select

or

Range(Cells(1,"A"),Cells(6,"B").Select

or

Cells(1,"A").Resize(6,2).Select

or ...

Set rng = Range("A1")
Range(rng(1,1),rng(6,2)).Select

Alan Beban


All times are GMT +1. The time now is 09:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com