ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting a range relative to an active cell (https://www.excelbanter.com/excel-programming/408370-selecting-range-relative-active-cell.html)

Steve Trombulak

Selecting a range relative to an active cell
 
I'm trying to modify the code in a macro to let me select a range of cells
relative to an active cell. I know how to select a SINGLE cell relative to
an active cell using OFFSET. For example, selecting a cell two columns to
the right and on the same row as an active cell is accomplished with:

ActiveCell.Offset(0,2).Select

But I can't figure out how to use relative cells with RANGE. What if I
wanted to select the cells that are two AND three columns to the right of an
active cell?

Thanks for any tips.

Bob Phillips

Selecting a range relative to an active cell
 
ActiveCell.Offset(0,2).Resize(,2).Select

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Steve Trombulak" wrote in
message ...
I'm trying to modify the code in a macro to let me select a range of cells
relative to an active cell. I know how to select a SINGLE cell relative
to
an active cell using OFFSET. For example, selecting a cell two columns to
the right and on the same row as an active cell is accomplished with:

ActiveCell.Offset(0,2).Select

But I can't figure out how to use relative cells with RANGE. What if I
wanted to select the cells that are two AND three columns to the right of
an
active cell?

Thanks for any tips.




Steve Trombulak

Selecting a range relative to an active cell
 
Great, Bob. Thanks a bunch.

s

"Bob Phillips" wrote:

ActiveCell.Offset(0,2).Resize(,2).Select

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Steve Trombulak" wrote in
message ...
I'm trying to modify the code in a macro to let me select a range of cells
relative to an active cell. I know how to select a SINGLE cell relative
to
an active cell using OFFSET. For example, selecting a cell two columns to
the right and on the same row as an active cell is accomplished with:

ActiveCell.Offset(0,2).Select

But I can't figure out how to use relative cells with RANGE. What if I
wanted to select the cells that are two AND three columns to the right of
an
active cell?

Thanks for any tips.






All times are GMT +1. The time now is 10:14 PM.

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