PDA

View Full Version : After clicking the linked cell to move back linked cell without using F5+Enter



ysfuyar
04-28-2020, 07:09 AM
Hi guys i got a lot of linked excel sheets and books so i am continuously jumping sheet to sheet (cell2cell,book2book) and i wanna return back (after and after) the sheet or the cell without using F5+Enter funciton. Is it possible run a macro, i am looking for it for a long time, appreciate that

SamT
04-28-2020, 07:55 AM
Copy the TOC sheet in the attachment into your workbook. You might have to view a different sheet, then switch back to TOC to start it

ysfuyar
04-28-2020, 08:49 AM
You could put this in the ThisWorkbook code module

' in ThisWorkbook code module

Public PrevActiveCell As Range
Dim CurActiveCell As Range

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Set PrevActiveCell = CurActiveCell
Set CurActiveCell = ActiveCell
End Sub

and then call this (in a normal module) to return to the previous cell


Sub GoBack()
If Not ThisWorkbook.PrevActiveCell Is Nothing Then
Application.Goto ThisWorkbook.PrevActiveCell
End If
End Sub

This one looks like my solution but i couldn't run it. I may be not clear about the what the problem is. Is the formule that you share serves to same purpose ? and i do double click with using ctrl+l button so to go back i need a button. Thanks a lot for your support i am beginner :)