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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cell Reference in VBA

Status
Not open for further replies.

cmz21

Programmer
May 5, 2005
110
0
0
US
hello,
I am using the following code to create a formula in a cell which refers to a cell on another worksheet -

xlSheet.Range("I21").Formula = "='Worksheet Name'!E29"

Every time I try to run the code, a browse for file dialog box opens up. How can I tell the code to use the named worksheet from the same workbook?

Hope this makes sense.
thanks for any help
 
I have solved my own problem. In my coding, I stupidly didn't take into consideration that I was creating a new workbook and was trying to reference the second sheet before it was actually created. I moved that line of code to the end of my sub and it worked fine.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top