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

Questions about Quotes for Forumulas in Excel

Status
Not open for further replies.

trifest

Programmer
Sep 5, 2002
52
US
I'm trying to assign a formula to a cell in Excel in my macro code. I'm having problems with the quotes. here's the formula I'm trying to paste into excel from the VBA code.

FormulaString = "=if(Indirect(Address(" & row1 & ",3,4)=Indirect(Address(" & row2 & ",2,4,TRUE,"Sheet1"),0,1)"

The problem is that it doesn't like the quotes within the quotes for the formula and gives me an Expected End of Statement Error. Is there anyway to get around this. Thanks for all the help.
 
You want Sheet1 in quotes?
Try this:

FormulaString = "=if(Indirect(Address(" & row1 & ",3,4)=Indirect(Address(" & row2 & ",2,4,TRUE,""Sheet1""),0,1)"
 
try:
FormulaString = "=if(Indirect(Address(" & row1 & ",3,4)=Indirect(Address(" & row2 & ",2,4,TRUE," & CHR(34) & "Sheet1" & CHR(34) & "),0,1)"
Tranpkp
************************************
- Let me know if this helped/worked!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top