Inputting data through a VBA input box

  • Thread starter Thread starter Big Chris
  • Start date Start date
B

Big Chris

I'm learning VBA, but it's slow going and I'm struggling with some areas
which I'm sure should be simple.....

I want to run a macro that brings up a simple input box. The user
enters an 8 digit number and then clicks on OK. I want this number to
be placed in a specific cell in my workbook. How can I achieve this
please?
 
Chris, use something like this
Sub Number()
MyNum = InputBox("Enter Discount Amount", "Discount Amount")
If MyNum = "" Then
Exit Sub
End If
Range("B6").Value = MyNum
End Sub

--
Paul B
Always backup your data before trying something new
Using Excel 97 & 2000
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
Forgot to take the titles out of the example

Sub Number()
MyNum = InputBox("Enter Your Number", "Title here")
If MyNum = "" Then
Exit Sub
End If
Range("B6").Value = MyNum
End Sub



Paul B said:
Chris, use something like this
Sub Number()
MyNum = InputBox("Enter Discount Amount", "Discount Amount")
If MyNum = "" Then
Exit Sub
End If
Range("B6").Value = MyNum
End Sub

--
Paul B
Always backup your data before trying something new
Using Excel 97 & 2000
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
Back
Top