ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Contiguous Column Selection using variables (https://www.excelbanter.com/excel-programming/313528-contiguous-column-selection-using-variables.html)

Leslie Payne

Contiguous Column Selection using variables
 
Hello,

I am looking for a way to select 28 contiguous columns using
variables.

x = Activecell.Column

I would like to select the column after x (say 22, through 40)

I know the following works:
Columns(x+1).select would only select the first column but how do I
select the remaining 28 columns?

Thank you
Leslie

Tom Ogilvy

Contiguous Column Selection using variables
 
Columns(x+1).Resize(,28).select

--
Regards,
Tom Ogilvy


"Leslie Payne" wrote in message
om...
Hello,

I am looking for a way to select 28 contiguous columns using
variables.

x = Activecell.Column

I would like to select the column after x (say 22, through 40)

I know the following works:
Columns(x+1).select would only select the first column but how do I
select the remaining 28 columns?

Thank you
Leslie




Bob Phillips[_6_]

Contiguous Column Selection using variables
 
Hi Leslie,

Try this

ActiveCell.Resize(1, x).EntireColumn.Select


--

HTH

RP

"Leslie Payne" wrote in message
om...
Hello,

I am looking for a way to select 28 contiguous columns using
variables.

x = Activecell.Column

I would like to select the column after x (say 22, through 40)

I know the following works:
Columns(x+1).select would only select the first column but how do I
select the remaining 28 columns?

Thank you
Leslie




Alan Beban[_2_]

Contiguous Column Selection using variables
 
Leslie Payne wrote:

Hello,

I am looking for a way to select 28 contiguous columns using
variables.

x = Activecell.Column

I would like to select the column after x (say 22, through 40)

I know the following works:
Columns(x+1).select would only select the first column but how do I
select the remaining 28 columns?

Thank you
Leslie

23 through is only 18 columns.

Alan Beban


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

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