revert back to cell A1

tintin1012000

Board Regular
Joined
Apr 27, 2011
Messages
237
Hi all,

I have a graph set up at the top of a sheet
The trouble is that the input data for the chart is in row 1000 +

What I want is after a period of time lets say 60 seconds of no inputs the sheet moves back up to cell a1 therfor my graph will be on display

Can anyone help
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
to move back to cell A1 you can simply click CTRL + Home at any time, would this suffice?
 
Upvote 0
I think your users might find this "feature" is more annoying then useful ;) but I thought I'd have a look just to see if it could be done.

I'll assume you know how to create VBA code etc in this description. If you don't then let me know.

Create a new VBA module and enter the following in it.

Code:
Public NextTime As Date
Sub Scroll()
    Cells(1, 1).Select
End Sub

In the code area for the sheet you have the graph and data on enter the following.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If NextTime > Now Then
        'Cancel the existing one
        Application.OnTime EarliestTime:=NextTime, Procedure:="Scroll", Schedule:=False
    End If
 
    NextTime = Now + TimeValue("00:01:00")
 
    Application.OnTime NextTime, "Scroll"
End Sub


In the code area for the Workbook itself enter the following. This cancels any outstanding scrolls which would cause the workbook to reopen.

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    If NextTime > Now Then
        Application.OnTime EarliestTime:=NextTime, Procedure:="Scroll", Schedule:=False
    End If
End Sub

I've tested it for various scenarios and it seems to work fine. Give it a go and let me know how you get on.

Cheers

Gordon
 
Last edited:
Upvote 0
Had another think about this. As it stands, if the user makes a change which schedules a scroll in 60 seconds and then moves to another worksheet then the new sheet will scroll to the top ... not really what you want. To overcome this change the Scroll procedure to the following, but change Sheet1 to whatever the name of your sheet is.

Code:
Sub Scroll()
    If ActiveSheet.Name = "Sheet1" Then
        Cells(1, 1).Select
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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