Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cell reference syntax Fred Excel Worksheet Functions 2 December 16th 08 04:01 PM
Worksheet reference syntax? Matt Excel Discussion (Misc queries) 3 May 19th 08 09:02 PM
Syntax for using variables in a cell formula to reference paths/fi colorado808 Excel Worksheet Functions 4 March 15th 07 03:41 AM
Syntax to return the value of a control by reference Broadband Al Excel Discussion (Misc queries) 3 January 26th 06 01:20 AM
what is the correct syntax for an allowable circular reference? excell idiot Excel Discussion (Misc queries) 1 March 10th 05 05:17 PM


All times are GMT +1. The time now is 10:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"