Relative range using variable

jnathan

New Member
Joined
Jul 8, 2013
Messages
48
I am trying to get the following to work: (rowCount is my variable)

Range("L" & rowCount:"R" & rowcount).Select

but I am getting a Compile Error:Syntax Error.

Can anyone help me and let me know where I am going wrong with this?

Many thanks

J
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I am trying to get the following to work: (rowCount is my variable)

Range("L" & rowCount:"R" & rowcount).Select

but I am getting a Compile Error:Syntax Error.

Can anyone help me and let me know where I am going wrong with this?

The colon is text and must be included with the rest of the text constants (inside the quotes)...

Range("L" & rowCount & ":R" & rowCount).Select
 
Upvote 0
Many thanks, Rick! I knew it was something like that but working late in the office means that the 'ol grey matter is slowing down.

Much appreciated!

J

The colon is text and must be included with the rest of the text constants (inside the quotes)...

Range("L" & rowCount & ":R" & rowCount).Select
 
Upvote 0

Forum statistics

Threads
1,215,947
Messages
6,127,867
Members
449,410
Latest member
adunn_23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top