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?
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
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.