VBA get user input

Dim is used to declare a new variable. The word following Dim is the variables name and can be called later on after the variable value is assigned. As Variant indicates the variable can be any data type, text or a number.

 

Dim myValue As Variant

Dim = Declare new variable

myValue = new variables name

As Variant = Data type can vary, text or number.

myValue = InputBox("Message boxes help text here")
Sub Get_User_Input()
Dim myValue As Variant

myValue = InputBox("User input")
Range("B1").Value = myValue

End Sub

Interested in learning new skills?