Mix integer and string in MsgBox : Variable Type « Language Basics « VBA / Excel / Access / Word






Mix integer and string in MsgBox

 
Sub msgBox()
   'Declare the variables
   Dim intNumber1 As Integer
   Dim intNumber2 As Integer
   Dim intSum As Integer

   'Create InputBoxes to enter numbers
   intNumber1 = 1
   intNumber2 = 2
   'Add numbers
   intSum = intNumber1 + intNumber

   Debug.Print "The numbers entered were " & intNumber1 & " and " & intNumber2
End Sub

 








Related examples in the same category

1.Types of Variables
2.Define an integer
3.Read integer number from InputBox
4.Define a string variable