VBA to set form scroll bar control minimum using another scroll bar

RickOlson

New Member
Joined
Aug 20, 2010
Messages
16
I'm working on a project that uses scroll bars on a worksheet named "Interface" to change the values of cells on another worksheet named "Calculations". Because the final workbook will be used on PCs and Macs I'm using form controls instead of ActiveX.

One thing users set is the projected total % of homes renovated by the end of 2015 and by 2020. In the abstract, the range for either year is between 0% and 50%. But I need to make certain that the % selected for 2020 is at least as large as the % selected for 2015.

My intention was to change the min for the 2020 scroll bar whenever the 2015 scrollbar is changed. Is this possible? As far as I can tell there aren't any events for form controls. I tried creating a sub named Testit in a module and making that the macro for the 2015 scroll bar, but when I set a break point in the Testit, moving the 2015 scroll doesn't seem to trigger Testit. I also tried putting Testit into the code for the worksheet that has the scroll bars, but that didn't do anything.

Even if it did I'm not sure how I'd change the min of the 2020 scrollbar with vba. Would it be with something like:
ActiveSheet.Shapes(Scroll2020).Min =ActiveSheet.Shapes(Scroll2015).Value

Thanks for any light you can shed on this--
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
HI,
Been ages since i used scroll bars but there is a change event for scroll bars.

double click the bar in vba and it should defult to the change event.
 
Upvote 0
Thanks for finding my question so many pages, into the forum and bumping it. It looks like the double-click trick works with ActiveX controls, but not the Forms control that I need.
 
Upvote 0
if on a sheet, i just inserted a form control, went to the developer tab and clicked view code. comes up with the change event
 
Upvote 0
if on a sheet, i just inserted a form control, went to the developer tab and clicked view code. comes up with the change event

<Hanging my head sheepishly> I completely overlooked that View Code button. It's late now. I'll look at it tomorrow. Thanks for the hint.
 
Upvote 0
That is not really a change event, it's just a macro called controlname_change (which is why it's in a normal module). However, an assigned macro should be triggered by a change in the scrollbar.
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,461
Members
452,915
Latest member
hannnahheileen

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