ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting Ranges (https://www.excelbanter.com/excel-programming/352679-selecting-ranges.html)

Barb Reinhardt

Selecting Ranges
 
I want to select the following range:

Range("BW2:CF2").Select

However, I want to be able to change the 2 to a different number
programmatically using i as the variable.

I've tried

Range("BW"&i ":CF"&i).Select

and it just doesn't work. What am I doing wrong?

Thanks,
Barb Reinhardt

Trevor Shuttleworth

Selecting Ranges
 
Barb

close ... try:

Range("BW" & i & ":CF" & i).Select

or

Range(Cells(i, "BW"), Cells(i, "CF")).Select

Regards

Trevor


"Barb Reinhardt" wrote in message
...
I want to select the following range:

Range("BW2:CF2").Select

However, I want to be able to change the 2 to a different number
programmatically using i as the variable.

I've tried

Range("BW"&i ":CF"&i).Select

and it just doesn't work. What am I doing wrong?

Thanks,
Barb Reinhardt




Jim Thomlinson[_5_]

Selecting Ranges
 
You are missing one "&"

Range("BW" & i & ":CF" & i).Select
--
HTH...

Jim Thomlinson


"Barb Reinhardt" wrote:

I want to select the following range:

Range("BW2:CF2").Select

However, I want to be able to change the 2 to a different number
programmatically using i as the variable.

I've tried

Range("BW"&i ":CF"&i).Select

and it just doesn't work. What am I doing wrong?

Thanks,
Barb Reinhardt


Barb Reinhardt

Selecting Ranges
 
I looked and looked for that. Don't ask me why I missed it.

Thanks! I knew someone here would find it quickly.

"Jim Thomlinson" wrote:

You are missing one "&"

Range("BW" & i & ":CF" & i).Select
--
HTH...

Jim Thomlinson


"Barb Reinhardt" wrote:

I want to select the following range:

Range("BW2:CF2").Select

However, I want to be able to change the 2 to a different number
programmatically using i as the variable.

I've tried

Range("BW"&i ":CF"&i).Select

and it just doesn't work. What am I doing wrong?

Thanks,
Barb Reinhardt



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

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