0
以下は私のコードの問題な部分です。コードはInputCodeを使ってProductCodeとQuantityを取り込みますが、ProductCodeが入力されると、その値の横にある "Cost"と "Discount"を定義して最終的に表示することもできます入力ボックス。どんな助けでも大いに感謝します。VBAで複数のセル/範囲を宣言/定義して同時に選択するにはどうすればよいですか?
'Obtaining VLookup Value
ProductCode = InputBox("Enter the ProductCode's code.")
'Error checking
Do Until ErrorCheck = False
If ProductCode = "" Then
ErrorCheck = True
MsgBox ("Not a valid entry.")
ProductCode = InputBox("Enter the ProductCode's code.")
Cost = ActiveCell.Offset(0, 1).Select
MinQty = ActiveCell.Offset(0, 2).Value
Discount = ActiveCell.Offset(0, 3).Value
ElseIf IsError(Application.VLookup(ProductCode, myRange, 3, False)) Then
ErrorCheck = True
MsgBox ("The value entered was not found.")
ProductCode = InputBox("Enter the ProductCode's code.")
Else
ErrorCheck = False
End If
Loop
ありがとうございます。これはすごくうまくいった。また、Forループに自分のコード全体を配置して、購入したさまざまな製品の数をユーザーに問い合わせる方法は?つまり、ループを通過するたびに、購入した特定の製品に関する情報が得られます。 –
ようこそ。このサイトのルールに従って、1)あなたのコードの試行で新しい問題に新しい問題を投稿する必要があります。2)答えの横にあるチェックマークをクリックして、自分の答えを灰色で塗りつぶして表示してください。 – user3598756