Help making this VBA scroll bar work how i want it to?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
I want to keep a chart viewable on a sheet at all times, having seeen a lot of google coments saying it cant be done I thought what about using the VBA scroll bar as aposed to the excel one?

So a got as far as this

VBA Code:
Private Sub ScrollBar1_Change()
If Target.Cells.Count > 1 Then Exit Sub
With ActiveWindow.VisibleRange
ActiveSheet.ChartObjects(1).Top = .Top + 5
ActiveSheet.ChartObjects(1).Left = .Left + .Width - _
ActiveSheet.ChartObjects(1).Width - 45
End With
End Sub

but it doesnt work because Target.Cells. is not a thing,
so
If anyone can help me heres what i want

as I move the VBA scrollbar up or down the chart named Test1 top left corner is in line with the scroll bar (Thingy that you use to scroll up and down with.

please help if you can

Thanks

Tony
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,214,861
Messages
6,121,969
Members
449,059
Latest member
oculus

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