I am looking for a script that will take users back to the last sheet viewed/edited after a "delete macro runs" (not the last sheet in the workbook - previous sheet viewed/edited)
Below is script that I have that deletes the records on the "Returns" sheet
Sub Macro2()
Sheets("Returns").Select
ActiveWindow.SmallScroll Down:=-6
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
End Sub
My next would be to "jump" back to the last sheet that was viewed/edited. There are mutiple sheets in the workbook so I can not use the sheet names as I would not know exactly what sheet users last viewed.
Any help would be greatly appreciated.
Below is script that I have that deletes the records on the "Returns" sheet
Sub Macro2()
Sheets("Returns").Select
ActiveWindow.SmallScroll Down:=-6
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
End Sub
My next would be to "jump" back to the last sheet that was viewed/edited. There are mutiple sheets in the workbook so I can not use the sheet names as I would not know exactly what sheet users last viewed.
Any help would be greatly appreciated.