A
Adrian
Dear all,
Please be gentle with me! Having spent many years
programming in XLM, I am belatedly learning VBA. Progress
is slow because I'm used to the old ways.
How do I make a variable whose type is a range? I've tried
various things but I keep getting typename String, hence
later lines of code that need a Range will fail.
Two reasons for wanting to do this...
1. So that I can use variables to abbreviate my code.
2. So that I can change the value of a variable and then
make the same macro manipulate lots of different regions
of workbook/sheet.
Sub test()
src = Workbooks("Data.xls").Names("Mdatabase").RefersTo
MsgBox src & vbCrLf & TypeName(src)
'the next line fails
toprow = src.Row
End Sub
Please be gentle with me! Having spent many years
programming in XLM, I am belatedly learning VBA. Progress
is slow because I'm used to the old ways.
How do I make a variable whose type is a range? I've tried
various things but I keep getting typename String, hence
later lines of code that need a Range will fail.
Two reasons for wanting to do this...
1. So that I can use variables to abbreviate my code.
2. So that I can change the value of a variable and then
make the same macro manipulate lots of different regions
of workbook/sheet.
Sub test()
src = Workbooks("Data.xls").Names("Mdatabase").RefersTo
MsgBox src & vbCrLf & TypeName(src)
'the next line fails
toprow = src.Row
End Sub