Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference a cell in a worksheet from within Visual Basic Macro?

Status
Not open for further replies.

montypython1

Technical User
Joined
Jan 12, 2005
Messages
187
Location
US
Greetings,

What is the best way to reference a cell in a worksheet from within an Excel Macro?

Specifically, I need my Excel Macro to pull the value from cell "B9" from within the "Admin" worksheet. I have tried using the following, but this generates an error:
lcFileNameDataGL = Admin!B9
This formula works if I am referencing a cell from within another cell, but it does not work within the Macro.

I should mention that this Macro works perfectly. And I realize that I could easily edit the Macro, but since this Excel workbook will be used by non-techy people, I need them to be able to change the folder location within a worksheet (I do NOT want them messing around with the Macro).

Any ideas?

Thanks,
Dave
 


hi,

VBA questions are best addressed in forum707.
Code:
lcFileNameDataGL = sheets("Admin").Range("B9").value


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi Skip,

Thank you for directing me to the correct forum, and for answering my question. I will try out your suggestion, but I'm sure it will work perfectly.

Thanks,
Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top