Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can someone please tell me what I'm doing wrong?
If I use a variable vRngName and set it to NamedRng1 (the name of a named range), this procedure runs fine. Sub test() Dim vRngName As String vRngName = "NamedRng1" Range(vRngName).Select End Sub Now if I split this into 2 procedures and put Public vRngName As String at the top of the module and run the following, I get an error on line 1 of the second procedure "Method 'Range' of object' _global' failed" Sub test() Dim vRngName As String vRngName = "NamedRng1" Call test2 End Sub Sub test2() Range(vRngName).Select 'error is here End Sub Why does using 2 procedures cause this to fail? Thanks for the help |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SaveAS w/ a variable name problem | Excel Programming | |||
Problem with a defined variable | Excel Programming | |||
Object variable problem | Excel Programming | |||
vba variable problem | Excel Programming | |||
Problem trying to us a range variable as an array variable | Excel Programming |