How to create a back button in Excel to move the user to the place where he came from?

Please tell me if the script is executable: the user clicks on the Sheet1!A1 cell with the Detail button and he moves it to Sheet2!B1 , where he can click the Back button on the same line to go back to Sheet1!A line from which he came. In the same way, he can click the Sheet1!J1 cell with the “Go Details” button, which moves it to the same Sheet2!B1 , but this time the back button returns it back to the Sheet1!J , so that it remembers the position user from.

+4
source share
4 answers

Paste this code into the ThisWorkbook routine:

 Private rngLastLink As Range Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink) If UCase(Target.Parent.Value) = "BACK" Then If rngLastLink Is Nothing Then Application.EnableEvents = False Target.Follow Application.EnableEvents = True Else rngLastLink.Worksheet.Activate rngLastLink.Activate End If Else Set rngLastLink = Target.Parent End If End Sub 

It will save the cell from any clicked hyperlink that is not called Back. If you click "Back", it activates this cell again.

+3
source

If the user selects Excel> Quick Access Toolbar> All Commands. Add "Back" and "Foward", they will have back and forth navigation after jumping links, as on a web page.

+3
source

First you will need to create a new button, then after the button is successfully created, the destination macro screen appears.

Copy this code

 Sub Button1_Click() Worksheets("sheet2").Activate End Sub 

like a macro

change sheet2 to suit your scenario.

 Private Sub Workbook_SheetDeactivate(ByVal Sh As Object) Sheets.Select ActiveCell.EntireRow.Select ActiveSheet.Select 

will synchronize the entire row between sheets - will work only when changing tables ...

 Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Sheets.Select ActiveCell.EntireRow.Select ActiveSheet.Select End Sub 

will be triggered every time the user changes cells in the active sheet.

0
source

I used the Alt-Left arrow to return.

 Sub GoBackToWhereverYouCameFrom() Application.SendKeys ("%{LEFT}") End Sub 
0
source

All Articles