2017-11-24 14 views
0

これは私のコードです:VBA - 入力ボックス - ユーザーフォーム

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はExcelで正しく表示されつつあります。しかし、Description入力ボックスに文字を入力すると、エラーが発生します。しかし、もし私がnoと入力すると。それは通過しますが、FALSEとExcelセルに表示されます。これは、両方ともの場合です。Descripton & Amountです。

誰かが助けることができますか?

+0

'Description 'はどのように定義されていますか? – GSerg

+0

「Dim Description As Bool」と書いてありますか? – iBug

答えて

1

あなたは彼らが正しい入力を取るために、あなたの変数を宣言し、コードの上にこれを配置する必要があります。

Dim qty as Integer 
Dim Unitp as Double 
Dim Description as String 
Dim Amount as Integer 
0

この問題が解決されます。私は他の変数についての記述を宣言していました。 Amountフィールドにwiseのように、Desc &に説明を変更しました。

うまく働いた。

あなたの助けを借りてくれてありがとう!

関連する問題