Dropdown list and Vlookup simplification

jmcconnell

New Member
Joined
Feb 2, 2019
Messages
35
Hi,

I've got a drop down list (SiteList) and when I select an option for that list it looks up details in a spreadsheet called AMSM and fills in a text box(SMName) on the same sheet as the drop down list. There is about 30 options in the drop down list. There is a sample of 2 below:


Private Sub SiteList_Change()
Dim ws As Worksheet
Dim SManager As String
Set ws = Sheets("AMSM")

If SiteList = "Kelburn" Then
SManager = Application.VLookup("Kelburn", ws.Range("A1:c112"), 3)
SMName = SManager
ElseIf SiteList = "Garreg Lwyd" Then
SManager = Application.VLookup("Garreg Lwyd", ws.Range("A1:c112"), 3)
SMName = SManager
End IF

Rather than having if statements as above for all 30 options, is there a way of simplifying this - Perhaps with a loop?

Thank you for your help!!!
Kind regards,
James.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,578
Members
449,174
Latest member
chandan4057

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