##### Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

# How to Refer a Input from InputBox in vba

0

Hi,

``````If Trim(wsh3.Range("A2").Value) = "ABC" Then
wb1.Activate
''input box
at6 = Application.InputBox("Amount", , 0, Type:=1)

au6 = wsh1.Range("Ax5").Value
If au6 = "" Then
wsh1.Range("AX5").Value = at6 * 0.25
av6 = at6 * 0.75
Else
av6 = at6 - au6 ``````
`    End If`

How do i refer the input putted in at6 below for doing calculation

0

Rider

Not sure what you mean by "refer the inputputted in at6" in the question, but in your code:

``````If Trim(Range("A2").Value) = "ABC" Then

''input box
at6 = Application.InputBox("Amount", , 0, Type:=1)

au6 = Range("A1").Value
If au6 = "" Then
wsh1.Range("AX5").Value = at6 * 0.25
av6 = at6 * 0.75
Else
av6 = at6 - au6
End If
End If``````

(with an added End If for my testing), at6 is returned from your InputBox (and replaces the 0 (in bold) you have set as the default value.

You can see the value assigned to at6 if you if you step through the code (using F8) and watch it change value in VB Project Explorer's Intermediate window.

Hope this helps.