Macro - Select Items in Dropdown Lists

jaihawk8

Board Regular
Joined
Mar 23, 2018
Messages
59
Office Version
  1. 2016
Platform
  1. Windows
I am creating a spreadsheet for our Sales Reps to use to calculate their commissions. In this spreadsheet, there are several drop-down lists that they can select from. For Example:

Order Type: Commercial, Government, State

Sales Type: Standard, Promotional, Government
Maintenance: None, Premier, Standard

I'm worried that they will just re-use the sheet for each sale and forget to change the drop-down lists back to their standard settings. I would like to create a Macro, that I can assign to a text box, that will select a specific thing in each list when it is run. For example:

Order Type: Commercial
Sales Type: Standard
Maintenance: None

Is this possible? When I try to record myself doing this, it doesn't seem to take.

Thanks!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi,

It needs to be listed as a Workbook operation instead of a General Declaration. Something like this should work;

Code:
Private Sub Workbook_Open()


Range("A1").Value = "Commercial"
Range("A2").Value = "Standard"
Range("A3").Value = "None"


End Sub
Change the A1,A2,A3 references for the cells you're using.

You'll need to enter this in the "ThisWorkbook" code.

Hope this helps
 
Last edited:
Upvote 0
Hi,

It needs to be listed as a Workbook operation instead of a General Declaration. Something like this should work;

Code:
Private Sub Workbook_Open()


Range("A1").Value = "Commercial"
Range("A2").Value = "Standard"
Range("A3").Value = "None"


End Sub
Change the A1,A2,A3 references for the cells you're using.

You'll need to enter this in the "ThisWorkbook" code.

Hope this helps


Thank you for your response. Just so I understand, by putting this in the VBS section of ThisWorkbook, will this run each time the workbook is opened? I wouldn't want that if the Sales Rep was opening one that they saved and was wanting to make changes to it.
 
Upvote 0
Thank you for your response. Just so I understand, by putting this in the VBS section of ThisWorkbook, will this run each time the workbook is opened? I wouldn't want that if the Sales Rep was opening one that they saved and was wanting to make changes to it.

Yes
 
Upvote 0

Forum statistics

Threads
1,216,337
Messages
6,130,106
Members
449,558
Latest member
andyamcconnell

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