ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting more than one cell/colum with an offset statement? (https://www.excelbanter.com/excel-programming/385362-selecting-more-than-one-cell-colum-offset-statement.html)

Fred Holmes

Selecting more than one cell/colum with an offset statement?
 
The vba statement:

ActiveCell.Offset(0, 3).EntireColumn.Select

Works just fine to select the third column to the right of the active
cell.

Is there a nice, clean, simple statement that would select the third
and fourth columns to the right, something like:

ActiveCell.Offset(0, 3:4).EntireColumn.Select

which doesn't work.

I'm basically trying to program a "column move" macro that prompts for
the column(s) to move, and how many column(s) to the right/left to
move it, and then performs the move. Is there one of those already out
there to copy?

Thanks,

Fred Holmes

[email protected]

Selecting more than one cell/colum with an offset statement?
 
Hi
ActiveCell.Offset(0, 3).Resize(1,2).EntireColumn.Select

Resize(1,2) leaves the row dimension at 1 and ups the column dimension
to 2.

regards
Paul


On Mar 15, 4:56 pm, Fred Holmes wrote:
The vba statement:

ActiveCell.Offset(0, 3).EntireColumn.Select

Works just fine to select the third column to the right of the active
cell.

Is there a nice, clean, simple statement that would select the third
and fourth columns to the right, something like:

ActiveCell.Offset(0, 3:4).EntireColumn.Select

which doesn't work.

I'm basically trying to program a "column move" macro that prompts for
the column(s) to move, and how many column(s) to the right/left to
move it, and then performs the move. Is there one of those already out
there to copy?

Thanks,

Fred Holmes





All times are GMT +1. The time now is 12:58 PM.

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