View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default More help with Sumproduct VBA

John,

A platform independant (for the PC and Mac) way of doing a new line is
vbNewLine instead of vbcrlf. It's easier to remember too.

Rob


"John Wilson" wrote in message
...
Tom,

That works too, but I like this better:

Sub MySub()
On Error GoTo DumbMistake
' my code here
Exit Sub
DumbMistake:
MsgBox "How long is going to take for me to remember" & vbcrlf & _
"that I have to enclose a quote within quotes if I want" & vbcrlf & _
"the quote to appear in the cell formula from VBA?????"
End Sub

Thanks,
John

"Tom Ogilvy" wrote in message
...
Another way:

MyString = """Boston Garden {1}"""
? mystring
"Boston Garden {1}"

? "SUMPRODUCT((IndivStats!L5:L65536=" & myString &
")*(IndivStats!S5:S65536))"
SUMPRODUCT((IndivStats!L5:L65536="Boston Garden
{1}")*(IndivStats!S5:S65536))

--
Regards,
Tom Ogilvy

John Wilson wrote in message
...
Hi guys (and gals),

I have this:

MsgBox Evaluate("SUMPRODUCT((IndivStats!L5:L65536=""Bosto n Garden
{1}"")*(IndivStats!S5:S65536))")
Thanks Tom.

What I can't figure out........

Dim MyString as String
MyString = "Boston Garden {1}"

How do I subtitute MyString in the above formula???
I can't seem to get it to work.

Thanks,
John