Return to the sheet you just came from?

itsme2

Board Regular
Joined
Jul 29, 2006
Messages
66
What do incorporate into this code (if possible) that once the sheet viewed has been closed will return me to the sheet that sent me there...

Does that make sense?

Code:
Private Sub CloseSheet()
    ActiveWindow.SelectedSheets.Visible = False
End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi there,

Maybe something like this in your ThisWorkbook module would give you the last sheet viewed...

Code:
Public LastSheet As String

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
    LastSheet = Sh.Name
End Sub

Then you could use ..

Code:
Sheets(LastSheet).Select
 
Upvote 0

Forum statistics

Threads
1,225,846
Messages
6,187,363
Members
453,420
Latest member
ESCH1021

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