Question:
VBA Scroll to the right on a sheet?
johnymemo
2012-03-25 16:34:03 UTC
Hi
I have a spreadsheet where use inputs data in the first part of the spreadsheet, like between columns A to R. Then when user runs function, calculations are performed and plotted on severael plots on the same sheet, but the plots go from colums V to like AR. I want the user to be able to see the plots by clicking a button from the data entry part of the sheet. I only have one sheet.
I want to automatically scroll through 10 columns to see the plots...
Thanks
Three answers:
garbo7441
2012-03-25 18:16:33 UTC
Here is one way to 'scroll' using the ScrollColumn property. This example will increment the scroll column by 25 with each command button click.



Once the scroll column reaches 200, the scroll column will be reset to 1.



I would suggest you position your command button in column A, sized to the width of column A, and Freeze Panes. Otherwise, your button will at some point not be viewable on screen.



If the '25' increment is too large for your needs, adjust the value down to a number that works for you.



Here is the macro:



Sub SetScrollColumn()

If ActiveWindow.ScrollColumn >= 200 Then

ActiveWindow.ScrollColumn = 1

Else

ActiveWindow.ScrollColumn = ActiveWindow.ScrollColumn + 25

End If

End Sub
ochsner
2016-11-09 04:23:42 UTC
Right Vba
lotts
2017-01-16 18:58:57 UTC
i won't mirror the habit you describe while entering into archives interior the final row of a worksheet. Is it achievable there is already a macro putting the scroll assets to scroll up a nil.5 internet site?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...