0

This is my code:

qty = InputBox("Please enter the quantity to be added.", "Add Quantity")
Cells(row, 2) = qty
Description = InputBox("Please enter a description.", "Enter Description")
Cells(row, 3) = Description
Unitp = InputBox("Please enter a unit price.", "Enter UnitPrice")
Cells(row, 4) = Unitp
Amount = InputBox("Please enter an amount.", "Enter Amount")
Cells(row, 5) = Amount

Qty & Unitp is getting displayed correctly in Excel. However, when I enter characters in the Description input box then it throws an error. But if I enter no. it goes through but displays as FALSE in the Excel cell. This is the case for both Descripton & Amount.

Can someone help?

2
  • How is Description defined? Commented Nov 24, 2017 at 9:35
  • Did you write Dim Description As Bool or so? Commented Nov 24, 2017 at 9:38

2 Answers 2

1

You need to Declare your variables for them to take the correct input, put this above your code:

Dim qty as Integer
Dim Unitp as Double
Dim Description as String
Dim Amount as Integer
Sign up to request clarification or add additional context in comments.

Comments

0

this issue is resolved. I had declared description for some other variable. Just changed it form Description to Desc & like wise for Amount fields.

Worked just fine.

Thanks for your help guys!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.