Drop Down List

southike

New Member
Joined
Feb 26, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
My work has an excel sheet that we upload to our core system. The sheet has to be in a very specific format. One column is for "account number". I want to create a drop down for the user, but if the drop down merely shows the account number, that does not help them. They need to be able to see the description of the account number as well. For example: 222333444 means nothing to them since they don't have all account numbers memorized. But if the drop down shows "222333444 Insurance Fees", then they would know which account number to select. However, the cell/column can be ONLY a number. It can't include the wording or the upload will fail. Any help is appreciated. Maybe a drop down is not the answer. Thank you.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Yes, this does help. I've created the "helper" column. And I've added the VBA to my sheet, but I'm getting the error "Wrong Entry". I edited the ranges in the VBA code to match mine. The columns are actually the same, just added some more rows. Any reason why I'm getting this error?

Edit: I may have found the problem. It's looking for E2:Ex..., but my "E2:Ex" is on another sheet. How do I edit the VBA to look at my other sheet. The other sheet is called "TABLES".
 
Upvote 0
Edit: I may have found the problem. It's looking for E2:Ex..., but my "E2:Ex" is on another sheet. How do I edit the VBA to look at my other sheet. The other sheet is called "TABLES".
Try changing this part:

VBA Code:
Set c = Range("E2:E11").Find(What:=v, LookIn:=xlValues, lookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
to this:
VBA Code:
Set c = Sheets("TABLES").Range("E2:E11").Find(What:=v, LookIn:=xlValues, lookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
 
Upvote 0
You're welcome, glad to help & thanks for the feedback.:)
Is the range "E2:Ex" a fixed range, or is it dynamic , meaning you plan to add new data row later on? If it's dynamic, we'll need to modify the code accordingly.
 
Upvote 0
It is fixed at E2:E21. Shouldn't be changed. But if it ever does change, you're right I'll have to edit that. Thanks for the heads up.
 
Upvote 0
This has been working flawlessly. But now, our team members occasionally need to type in an account number that is not one of the "normal" ones they use. It's the customers account number and we have thousands of customers, so I can't really put that in the drop-down. I need the first two cells (A2 and A3) to allow any number to be typed in...not from the drop down. I've removed the data validation for those two cells, but when I type in a random account number I'm getting the error message "Wrong Entry". Can this be done somehow? Thank you for your help.
 
Upvote 0
I need the first two cells (A2 and A3) to allow any number to be typed in
Try changing this part:
VBA Code:
                   If Not c Is Nothing Then
                        Target = v
                    Else
                        MsgBox "Wrong Entry"
                        Target.ClearContents
                    End If
to this:
VBA Code:
                    If Not c Is Nothing Then
                        Target = v
                    Else
                        If Intersect(Target, Range("A2:A3")) Is Nothing Then
                            MsgBox "Wrong Entry"
                            Target.ClearContents
                        End If
                    End If
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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