ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Entering variables on Msgbox prompt (https://www.excelbanter.com/excel-programming/349499-entering-variables-msgbox-prompt.html)

renegan[_6_]

Entering variables on Msgbox prompt
 

Hi,

I am trying to enter a variable on the prompt of a message box. Could
someone help me on this?

Thanks,

Variable: Range("Year")
Prompt: Msgbox "Yada yada yada (variable should go here) yada yada
yada"


--
renegan
------------------------------------------------------------------------
renegan's Profile: http://www.excelforum.com/member.php...o&userid=10450
View this thread: http://www.excelforum.com/showthread...hreadid=498001


evgny[_2_]

Entering variables on Msgbox prompt
 
Hi renegan
Dim a as variant
a = Range(???).value
Msgbox "Yada yada yada " & a & " yada yada"

Regards
Yngve


John[_88_]

Entering variables on Msgbox prompt
 
Assuming the result is a string you could use something like:

Dim sYear As String

sYear = Range("Year").Value
Msgbox "Yada yada yada " & sYear & " yada yada yada"

Best regards

John


"renegan" wrote in
message ...

Hi,

I am trying to enter a variable on the prompt of a message box. Could
someone help me on this?

Thanks,

Variable: Range("Year")
Prompt: Msgbox "Yada yada yada (variable should go here) yada yada
yada"


--
renegan
------------------------------------------------------------------------
renegan's Profile:
http://www.excelforum.com/member.php...o&userid=10450
View this thread: http://www.excelforum.com/showthread...hreadid=498001




renegan[_7_]

Entering variables on Msgbox prompt
 

Thank you both John and evgny. It worked fine.


--
renegan
------------------------------------------------------------------------
renegan's Profile: http://www.excelforum.com/member.php...o&userid=10450
View this thread: http://www.excelforum.com/showthread...hreadid=498001



All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com