Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Syntax for Range Reference
In a macro I have a string variable (macroName) that is set to the name of a
workbook. In the macro I am trying to retrieve information from the second worksheet of that workbook while another workbook is active. I have tried variations of the following syntax, but can't get either statement below to work. ColumnID = Workbooks(MacroName).Sheets(2).Cells(1, _ NumColsMacro).Address NormalHomeRng = Workbooks(MacroName).Sheets(2) & "!$A$1" Could someone please give me the correct syntax for these two lines? TIA. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Syntax for Range Reference
Not sure on the first one, as I don't knowm what _NumColsMacro is and why
you get the cell address, but it seems okay. For the second, try Set NormalHomeRng = Workbooks(MacroName).Sheets(2).Range("$A$1") -- HTH RP (remove nothere from the email address if mailing direct) "Ken" wrote in message ... In a macro I have a string variable (macroName) that is set to the name of a workbook. In the macro I am trying to retrieve information from the second worksheet of that workbook while another workbook is active. I have tried variations of the following syntax, but can't get either statement below to work. ColumnID = Workbooks(MacroName).Sheets(2).Cells(1, _ NumColsMacro).Address NormalHomeRng = Workbooks(MacroName).Sheets(2) & "!$A$1" Could someone please give me the correct syntax for these two lines? TIA. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
cell reference syntax | Excel Worksheet Functions | |||
Worksheet reference syntax? | Excel Discussion (Misc queries) | |||
Syntax for using variables in a cell formula to reference paths/fi | Excel Worksheet Functions | |||
Syntax to return the value of a control by reference | Excel Discussion (Misc queries) | |||
what is the correct syntax for an allowable circular reference? | Excel Discussion (Misc queries) |