Worksheet Names, Drop Downs, Reference

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Hi - I have a workbook with 51 tabs, 50 named after a state and 1 other. I have a drop down with each of the states on sheet1. How do i use the values in that drop down to reference one of the worksheets? Each of the state sheets would be the same, they would just have different data. I have code that will pull the data from the State sheet and put it in Sheet1. I guess I could have 50 macros, but I'm assuming there is a way to use the drop down value to reference a sheet.

So, set wsSTATE = Thisworkbook.sheets("Drop down Value Here")

Thanks.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
If your drop down is from data validation then you can just reference the cell.

So if the data validation drop down was in G2 you can use the below to return the value of S7 from the selected sheet.

Code:
Sub test()
Dim wsSTATE As Worksheet
wsname = Range("G2")
Set wsSTATE = ThisWorkbook.Sheets(wsname)
Range("A7") = wsSTATE.Range("S7")

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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