David,
Thank you once again.
First, in simplifying my post I used S1 as the name of my string, but in my code I actually used Msg, and as far as I can tell that was flagged as a #NAME error. (I went through so many iterations of quotation marks to eliminate syntax errors that I can't recall the statement I used that generated that #NAME error.)
I don't understand your code:
Range("B1").Formula = "= """ & MyString1 & """ & A1 & "" Cheap"""
I see that the first ", before the =, matches the very last " after Cheap, but why is MyString1 surrounded by 3 ", when Cheap needs only 2? And why is MyString1 surrounded by &'s? In the literal version
Range("B1").Formula = "=""Ripe "" & A1 & "" Cheap"""
Ripe gets only 2 ", and no &'s.
As for why I want to use a string variable. Suppose I have a very long string, like "Perfect Fruit Picked at the Peak of Freshness ". I thought it would be neater to assign that string to a variable instead of coding it in the statement.
Thanks for you help.
Mickey
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar