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

Nested Formula VBA problem

Status
Not open for further replies.

Lil8

Technical User
Oct 24, 2003
42
GB
I am using a nested if Formula below that works if it is typed into a Excel Spreadsheet but when I add it from a form as below I get an the "Fri" is highlighted and I get an error.

Sheets("Invoice").Range("C12").Formula = "=IF(E18="Fri",VLOOKUP(B18,tblWeekendPapers,2),IF( etc etc"

Please can any one suggest why it should work if typed in but not if added via VBA coding.

Thanks Nic
 
You have embedded quotes, but you aren't converting them to be used inside a quoted string.

Look at this and adapt your row of code:

ActiveCell.Formula = "=IF(E18=""Fri"",""Hooray POETS day"",""boohoo"")"

Good luck.

Cheers, Glenn.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top