ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Relative Addresses to Select Columns (https://www.excelbanter.com/excel-programming/274264-using-relative-addresses-select-columns.html)

Andrew Rallings

Using Relative Addresses to Select Columns
 
I want to to select the next 5 columns after the current cell. the next 5
columns will change week by week.

Absolute cell references work say

Columns("Q:U").Select

What I can't find a way to do is use relative addresses eg

Columns("C[1]:C[6]").Select

I tried variations on the syntax but all without success. All get various
syntax or type mismatch errors

Any ideas?

regards
Andrew

keepITcool

Using Relative Addresses to Select Columns
 
Andrew,

try:

columns("Q").resize(, 6).Select
or
columns(17).resize(, 6).Select

HTH


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Andrew Rallings" wrote:

I want to to select the next 5 columns after the current cell. the
next 5 columns will change week by week.

Absolute cell references work say

Columns("Q:U").Select

What I can't find a way to do is use relative addresses eg

Columns("C[1]:C[6]").Select

I tried variations on the syntax but all without success. All get
various syntax or type mismatch errors

Any ideas?

regards
Andrew




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

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