Drop-down box in VBA script

mpromney

New Member
Joined
Sep 21, 2017
Messages
6
I’m writing a macro that will take check registers downloaded from our accounting software and reformat them into the proper format so we can upload them to our bank’s positive pay system. We have approximately 30 different bank accounts that I have listed in a separate worksheet (let’s call it AccountMasterList.xlsx). I want the macro to present a dropdown box (listing the 30 accounts in AccountMasterList.xlsx) from which the user can select the account for which they’re running the macro. I can’t seem to figure out how to do this. Can anyone help? TIA
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I'm thinking the easiest way is to add another tab to your workbook (can be hidden if need be), and pull the account numbers into the current workbook. For example:
='AccountMasterList.xlsx]Sheet1'!$B$1
='AccountMasterList.xlsx]Sheet1'!$B$2
='AccountMasterList.xlsx]Sheet1'!$B$3
='AccountMasterList.xlsx]Sheet1'!$B$etc...

Then you can create your data validation field off of that list.
 
Upvote 0
I'm thinking the easiest way is to add another tab to your workbook (can be hidden if need be), and pull the account numbers into the current workbook. For example:
='AccountMasterList.xlsx]Sheet1'!$B$1
='AccountMasterList.xlsx]Sheet1'!$B$2
='AccountMasterList.xlsx]Sheet1'!$B$3
='AccountMasterList.xlsx]Sheet1'!$B$etc...

Then you can create your data validation field off of that list.
Thanks for the reply. It's the data validation that I'm having trouble coding. The account selected by the user will be used for a couple of purposes: (1) it will be used to name the saved check register and (2) it will be used to determine which portions of the remaining macro to run (we have two different accounting systems so the macros to format them into the format acceptable to our bank will be different).
 
Upvote 0
It sounds like you want to have a userform pop up with a dropdown field in it. In your VBA Project, do an Insert | Userform. Then on that userform, you can add text such as "Select Bank Account", then add a combobox to the userform. In the combobox property "RowSource", enter the range that lists your bank accounts. For example: Sheet1!A7:A37

In the code for the userform, you can then transform the selection as needed for the next steps of your code
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,140
Members
448,551
Latest member
Sienna de Souza

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