Storing "Last Sheet" Info in a cell

duncanhalleastey

New Member
Joined
Jul 3, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm by no means an excel wizard and have no doubt that his is a simple function so bare with/forgive my ignorance..

I have simple links across several sheets (January-December) that skip to a hidden sheet (Notes and Comments).

I want the "back button" in Notes to take the user back to the sheet they came from but don't know the function I should be using to capture the navigating sheets info from to load into either another simple link, or, button.

Hopefully I've done a good enough job of explaining what I'm trying to do here, and any help will be greatly apprecaited.

Thank you!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try placing the following subs in the workbook code section (not in a module) and assigning the Button1_Click sub to the "back button:"
VBA Code:
Dim sName As String
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
    sName = Sh.Name
End Sub
Private Sub Button1_Click()
    Sheets(sName).Activate
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,220
Messages
6,123,695
Members
449,117
Latest member
Aaagu

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