Can I use variables in the text portion of a message box?

A

AllInTheChi

Title says it all practically. I have a msgbox pop up at times in my
code to tell me about progress plateaus. What I want to do is
incorporate cell value calls, etc. in the msgbox text. Can I use
"CONCATENATE" or other cell functions within macro code?
 
A

AllInTheChi

Yes. Just use the concatenation operator ( & ) to produce your
string.

Something like:

var1 = "Is the Date "
var2 = #9/1/2010#
var3 = " OK?"

s = var1 & var2 & var3
MsgBox (s)

Cool. Thanks. I keep forgetting about making declarations right there
in the code.

Can I use range names and thereby extract cell values on the fly?
 
J

Jim Cone

Example... Application.WorksheetFunction.Sum
Use "&" in place of Concatenate... "Smith" & "Wesson" equals "SmithWesson"
See "List of Worksheet Functions" in Excel help.
--
Jim Cone
Portland, Oregon USA
http://www.contextures.com/excel-sort-addin.html

..
..
..

"AllInTheChi" <[email protected]>
wrote in message
Title says it all practically. I have a msgbox pop up at times in my
code to tell me about progress plateaus. What I want to do is
incorporate cell value calls, etc. in the msgbox text. Can I use
"CONCATENATE" or other cell functions within macro code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top