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

need help with strings and excel forumla's

Status
Not open for further replies.

jadedinvasion

Programmer
Feb 8, 2005
22
CA
I've got a bit of a head scratcher on my hands. I want to assign a formula to an cell on an excel spreadsheet, but the formula itself contains " (example below)

objWB.Worksheets(1).Cells(10, 17) = "=SUMIF(B10:M10,">0")/COUNTIF(B10:M10,">0")"

Obviously this isn't going to work. I tried being sneaky and changed the " to ' but that didn't work either.

I was wondering if i could possibly assign the ascii value for " to a string variable and include the necessary punctionation that way.

Any idea's how to get around this?

Thanks,
 
To use a quote in a formula (or anything 'physical', ie in the worksheet) via VBA, you'll need double quotes. Instead try ...

Code:
objWB.Worksheets(1).Cells(10, 17) = "=SUMIF(B10:M10,"">0"")/COUNTIF(B10:M10,"">0"")"

HTH

Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a MS MVP? PODA
- Leonardo da Vinci
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top