Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can only select a range if the worksheet that owns the range is active.
And you can only select a worksheet if the workbook that owns the worksheet is active. So you can pepper your code with workbooks("book1.xls").activate workbooks("book1.xls").worksheets("sheet1").select workbooks("book1.xls").worksheets("sheet1").range( "range_01").select or use application.goto _ workbooks("book1.xls").worksheets("sheet1").range( "range_01"), _ scroll:=true '? ====== And depending on where your code is (is it behind a worksheet?), you could have the problem because an unqualified range (range("range_01") belongs to the worksheet that holds the code. And that might not be where the range really is (and it blows up real good). Peter Morris wrote: I can select a named range like so : range ("range_01").select this works. but I want to make the selected range a variable like this: range_string = "range_01" range (range_string).select This gives me error messages "method range of object global failed" What is the correct syntax for doing this? -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting a range of rows based on a variable; syntax error | Excel Discussion (Misc queries) | |||
macro syntax for selecting variable range | Excel Discussion (Misc queries) | |||
syntax when using a variable in a formula | Excel Programming | |||
syntax for variable | Excel Programming | |||
Syntax to Set variable range | Excel Programming |