MsgBox question
How to display values of 2 variables which range from 4 to 15 in 1 message window using MsgBox?
ExcelExperts.comExcel Consultancy, VBA Consultancy, Training and Tips Call:+442081234832 |
|
Excel / VBA ConsultancyFree Training VideosFree SpreadsheetsExcel / VBA JobsNavigationWho's onlineThere are currently 0 users and 919 guests online.
New Excel Experts
Current Excel / VBA Jobs |
MsgBox questionHow to display values of 2 variables which range from 4 to 15 in 1 message window using MsgBox? |
Highest Ranked Users
Recent Blogs
ForumsRecent comments
User login |
You can generate random number pairs from the range
If variables are random, I would simply use:
MsgBox WorksheetFunction.RandBetween(4, 15) & " and " & WorksheetFunction.RandBetween(4, 15)
However, there is a drawback: there could be two same numbers together. If you don'want it, use this function and call it in message box (thanks to J.E. McGimpsey ):
Check it here: http://excelexperts.com/solution-how-display-values-2-variables-which-ra...
Thanks for the advice, but I
Thanks for the advice, but I need to set 2 variables as Integer and set their values from 4 to 15 first, then use MgBox to show their values. I know it must be basic stuff, but I never studied VBA.
Could you post desired output here?
Is this what you need?
Sub Test()
Dim V1 As Integer
Dim V2 As Integer
V1 = 4
V2 = 15
MsgBox V1 & " " & V2
End Sub