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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
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,226,224
Messages
6,189,728
Members
453,566
Latest member
ariestattle

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