Get sheet name for copy from a drop down

LannyN

New Member
Joined
Jun 19, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I am trying to automate processing a huge mailing list into manageable chunks. I have a workbook with 11 available sheets (mail routes) for copy destinations. I have dynamically build a dropdown list comprised of sheets that are "empty" and available to hold a new list segment. My problem lies in trying to convert the drop down value, which is the same as the sheet name, to make it work as follows where CpySht is the value from the drop down.

"Set SelectedRoute = ThisWorkbook.Sheets(CpySht)"

I've tried defining it as a range, concatenating it with ("" & CpySht), and a couple of other methods, but I keep getting an object variable error message.

Any ideas?

Thanks
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

davesexcel

Well-known Member
Joined
Feb 26, 2006
Messages
1,089
if CpySht is a string variable then
there should be no quotes in that line
If the dropdown is an actual combobox then it would be ThisWorkbook.Sheets(combobox1)
If data validateion then if would be the range of the data validation
ThisWorkbook.Sheets(range("A1").value)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,334
Messages
5,624,069
Members
416,010
Latest member
NJT

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
Top