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
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Watch MrExcel Video

Forum statistics

Threads
1,099,914
Messages
5,471,476
Members
406,764
Latest member
ExcelMaker007

This Week's Hot Topics

Top