How to use a variable in refering a range?

nicholasho

New Member
Joined
Oct 10, 2005
Messages
6
Hi,

I like to define a range to cover a column in a sheet. One of the method is as follows:


Set LookupSheet = Worksheets("Sheet5")
LookupLastRow = LookupSheet.Range("A65536").End(xlUp).Row


Set RangeOne = Worksheets("Sheet5").Range("$AX$2:$AX$(LookupLastRow)")

The last statement has syntax error with LookupLastRow. What's the syntax to retrieve the variable value and used in the range definition?

Thanks and Regards
Nick
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Nick

Code:
Set RangeOne = Worksheets("Sheet5").Range("$AX$2:$AX$" & LookupLastRow)
Best regards

Richard
 

Forum statistics

Threads
1,077,864
Messages
5,336,846
Members
399,105
Latest member
idleminutes

Some videos you may like

This Week's Hot Topics

Top