Re-defining a drop down object with VBA

braindiesel

Well-known Member
Joined
Mar 16, 2009
Messages
571
Office Version
  1. 365
  2. 2019
  3. 2010
Platform
  1. Windows
I believe this is an easy one. I just need a little help.

In a macro that chooses year 1, 2, or 3, I have the following code

Sheets("Dashboard").Shapes("Drop Down 36").ControlFormat.ListFillRange = "=myYear1"
Sheets("Dashboard").Shapes("Drop Down 37").ControlFormat.ListFillRange = "=myYear1"

Which works perfectly to define my list range.

The Cell Link looks should look at 'Year 1'!$H$1, or 'Year 2'!$H$1 or the same for year 3.

Can you help me with the code to declare that?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Never mind. Solved it.

I used the following lines

Sheets("Dashboard").Shapes("Drop Down 36").ControlFormat.LinkedCell = "=myYear1From"
Sheets("Dashboard").Shapes("Drop Down 37").ControlFormat.LinkedCell = "=myYear1To"

and just renamed the relevant cells.

I had tried not naming the cells by using
Sheets("Dashboard").Shapes("Drop Down 37").ControlFormat.LinkedCell = Sheets("sheetName").range("H1").address
but the result was $H$1, not sheetName!$H$1 as was needed

If someone can resolve how to make the sheet name stick, I'd be interested
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,713
Members
452,939
Latest member
WCrawford

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