how return to last used sheet?

  • Thread starter Thread starter Rolando
  • Start date Start date
R

Rolando

Hi there!

in a worksheet_activate event I test a number of variables and then ask the
user if it want to continue. If not, the user should come back to the sheet
it came from, "the previous visited". The "previous method" doesn't work
since it take you back to the previous sheet "in index". The user have 10
sheets that could be the previous visited.

what method should I use?

Regards!
 
Rolando,

I think you need to manage it yourself. Add this to THisWorkbook, and then
you can use the variable PrevSeet, but note that you will need
ThisWorkbook.PrevSheet from your code.

Public PrevSheet As String

Private Sub Workbook_Open()
PrevSheet = ActiveSheet.Name
End Sub

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

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top