View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Code for Returning to Last Active Worksheet Please

This should work from the sheet where you were before firing the macro.
However, WHY are you going to another sheet in the first place. It is rarely
necessarry to do so. Your instructions could be a msgbox or a userform or ?

Sub gobacktosheet()
Previous = ActiveSheet.Index
Application.Goto Sheets("sheet2").Range("a2")
MsgBox "Hi"
Sheets(Previous).Select
End Sub

--
Don Guillett
SalesAid Software

"Carl" wrote in message
...
Can anyone tell me the code to use in a macro to return the user to the
last
active worksheet? The user is being sent to a worksheet containing
instructions but needs to be able to return to the last worksheet visited.
"ActiveSheet.Previous.Select" did not work. Thanks in advance.