ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to specify a range in VBA based on values in cells (https://www.excelbanter.com/excel-programming/318328-how-specify-range-vba-based-values-cells.html)

Comcast Mail

How to specify a range in VBA based on values in cells
 
I'm a novice trying to build a macro that will select a range based on
values from calculated cells on a worksheet.

The macro should select a range denoted by the values of the two calculated
cells in the same row as the active cell.

Thanks in advance for your advice.

Donald Prebus
Vancouver WA



Trevor Shuttleworth

How to specify a range in VBA based on values in cells
 
Donald

not much detail of how you specify the cells so, you'll need something like:

Range(Range("A1").value & ":" & Range("A2").Value).Select

Where A1 contains a cell reference, for example, B1. Cell A2 contains the
next cell, for example, G17. In this case the range B1 to G17 will be
selected.

Regards

Trevor


"Comcast Mail" wrote in message
...
I'm a novice trying to build a macro that will select a range based on
values from calculated cells on a worksheet.

The macro should select a range denoted by the values of the two
calculated cells in the same row as the active cell.

Thanks in advance for your advice.

Donald Prebus
Vancouver WA





All times are GMT +1. The time now is 07:15 PM.

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