Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Back button Macro?

How can I create a generic back button for my workbook, so that it goe
to the last view worksheet? Is this even possible

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Back button Macro?

Fraggs,

Put this code in the ThisWorkbook code module

Public prevWs As Worksheet

Private Sub Workbook_Open()
Set prevWs = ActiveSheet
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Set prevWs = Sh
End Sub


and add this code to a standard code m odule and tie your button to it

Sub PrevSheet()
ThisWorkbook.prevWs.Activate
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Fraggs " wrote in message
...
How can I create a generic back button for my workbook, so that it goes
to the last view worksheet? Is this even possible?


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Back button Macro?

One way:



Code in a regular module:

Public OldSheetName As String

Public mySheetName As String

Sub ReturnToLastSheet()

Worksheets(OldSheetName).Activate

End Sub



Code in the Thisworkbook object:

Private Sub Workbook_Open()

MySheetName = "Sheet1" 'Change as appropriate

End Sub



Private Sub Workbook_SheetActivate(ByVal Sh As Object)

OldSheetName = mySheetName

mySheetName = Sh.Name

End Sub



Then assign the ReturnToLastSheet macro to a button.

HTH Otto

"Fraggs " wrote in message
...
How can I create a generic back button for my workbook, so that it goes
to the last view worksheet? Is this even possible?


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for forward and back button Kim Excel Discussion (Misc queries) 3 April 24th 09 05:28 PM
How can I call IE browser (Back button) through Excel macro? SAM SEBAIHI Excel Discussion (Misc queries) 0 December 14th 06 12:49 AM
How can I call IE browser (Back button) through Excel macro? SAM SEBAIHI Excel Discussion (Misc queries) 0 December 13th 06 04:50 AM
Reverse a Macro - works like back button spydor Excel Discussion (Misc queries) 1 January 3rd 06 12:39 AM
Back Button Macro ianripping Excel Programming 1 January 10th 04 11:57 AM


All times are GMT +1. The time now is 01:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"