Searchable Drop Down List Input

Jetx227

Board Regular
Joined
Jul 11, 2018
Messages
96
Hey guys,
So I have a sheet that has a list of items (A5 through A20,000, approx). Column B is for unit prices but they are not filled in. I want to populate this column for only specific items (as we only use maybe 100-200 of the 20,000). Is there a way to use a searchable drop down box to select the unit prices column and input the price we want? Or if anyone has a better idea how to do it, any input is appreciated. Thanks!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
So I decided to try a VBA code instead because I thought it would be a lot simpler (although I am pretty new to VBA code so bear with me). I tried to make a vba code where you click a button and an inputbox pops up, asks you for a item number, (then if you didn't input one it'll tell you and exit the code), then it'll ask you for a unit price (if you didn't input one it'll exit the code), then it'll find the cell that has the item number you inputted, skip from column A to Column C (same row) and input the unit price. But when I run if I keep getting an error at my first If statement. Any help would be appreciated, thanks!

Code:
Sub Add_Price_Click()


Dim ItemNo As Variant, UnitPrice As Variant, SearchRng As Range


ItemNo = Application.InputBox(Prompt:="Enter an Item Number:", Title:="Add Unit Price")
If ItemNo Is Nothing Then
    MsgBox ("Please enter an item number and try again.")
    Exit Sub
End If


Set SearchRng = Range("A:A").Find(ItemNo, "A4", xlValues)
If SearchRng Is Nothing Then
    MsgBox ("Item not in database.")
    Exit Sub
End If


UnitPrice = Application.InputBox(Prompt:="Enter the Unit Price:", Title:="Add Unit Price")
If UnitPrice Is Nothing Then
    MsgBox ("Please enter a unit price and try again.")
    Exit Sub
End If


SearchRng.Offset(0, 2) = UnitPrice


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top