Using activeX control scroll bar to move line on spreadsheet

griffb

New Member
Joined
Aug 29, 2014
Messages
1
I am trying to use an activeX scroll bar to move a vertical line across a set of graphs in a worksheet. I have a code that will move the line forward with each click of the scroll bar, but can't get it to move backwards when the scroll bar value decreases.

Code:
Private Sub ScrollBar1_Change()
Dim slider As Integer


Scroll = Sheets("FormattedGraphs").Range("A49") 'value of cell linked to scroll bar


ActiveSheet.Shapes("Straight Connector 86").Select 'vertical line drawn on sheet


Selection.ShapeRange.IncrementLeft 1 * Scroll 'pixels to move with each scroll bar click


End Sub

I'm not sure if there is an easy way to do this, it's my first time working with activeX controls. Or if there's a way to store the linked cell's previous value to use as a reference?

using Excel 2007
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,215,945
Messages
6,127,844
Members
449,411
Latest member
adunn_23

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