Return to a specific range or cell upon exit

jchapman

New Member
Joined
Apr 2, 2011
Messages
8
I am looking for a simple code that returns to a specific cell or range when you leave an active worksheet. As I have large worksheets that someone may navigate and end up in say cell PT1354. What I want is if someone returns to this worksheet, it will open in cell A1, or a named range, where data entry is required. I've been searching, but can't find it. Any ideas?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try putting this in the ThisWorkbook code module
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    With Sh
        Application.Goto Reference:=.Cells(1, 1), Scroll:=True
    End With
End Sub
 
Upvote 0
I probably didn't enter it correctly, but it doesn't work. I copied that into the module (nothing), then I tried to copy it into the object (nothing). Am I misunderstanding where to copy the code, or did I not explain it well? I only want it to apply to a specific worksheet in a workbook, so if you go to a different worksheet and then return to that worksheet, you start back at A1.
 
Upvote 0

Forum statistics

Threads
1,224,540
Messages
6,179,417
Members
452,912
Latest member
alicemil

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