Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home

Absolute vs. Relative reference

Posted by M Perry on June 14, 2000 12:34 PM
I'd like the macro I'm recording to go to a certain cell - say A3 - and set a range (to be used later in the macro) by choosing Shift/End/Down. The problem with the way I am doing this is that the VBA code in the macro records the absolute reference [Range("A3:A2660").Select]. Selecting the "relative reference" button does not solve this. Does anyone have any suggestions? Thanks!

Check out our Excel VBA Resources

Re: Absolute vs. Relative reference

Posted by JAF on June 16, 0100 1:20 AM

MP

The code you need is as follows:

Sub select_variable_range()
Range("A3").Select
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End Sub


JAF


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.