Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Previous Worksheet

I copied this a few days ago and it works fine, sorry that I cannot offer
thanks to the author. I failed to write down names.

Please I need everyones help. Thanks

Questions;
1. This code works 90% of the time, but then it locks, I can manually
restart it by using the sheet tags and going to any other sheet, then click
on the command button to revert back to the previous sheet and then that
button starts working again. WHY ?? Whats the fix ???????

2. How can this code be change to stack up to 5 previous worksheets in
memory, rather than flipping back and forth between the two same sheets ??

Previous Worksheet code;
----Placed in Thisworkbook----

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Not rCurrent Is Nothing Then Set rPrevious = rCurrent
Set rCurrent = ActiveCell
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Excel.Range)
If Not rCurrent Is Nothing Then Set rPrevious = rCurrent
Set rCurrent = Target
End Sub

----Placed in Module1---

Public rPrevious As Range
Public rCurrent As Range

Public Sub GoToPrevious()
If Not rPrevious Is Nothing Then Application.GoTo rPrevious
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Previous Worksheet

what is this code suppose to do???

-----Original Message-----
I copied this a few days ago and it works fine, sorry

that I cannot offer
thanks to the author. I failed to write down names.

Please I need everyones help. Thanks

Questions;
1. This code works 90% of the time, but then it locks, I

can manually
restart it by using the sheet tags and going to any other

sheet, then click
on the command button to revert back to the previous

sheet and then that
button starts working again. WHY ?? Whats the fix ???????

2. How can this code be change to stack up to 5 previous

worksheets in
memory, rather than flipping back and forth between the

two same sheets ??

Previous Worksheet code;
----Placed in Thisworkbook----

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Not rCurrent Is Nothing Then Set rPrevious =

rCurrent
Set rCurrent = ActiveCell
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As

Object, ByVal Target
As Excel.Range)
If Not rCurrent Is Nothing Then Set rPrevious =

rCurrent
Set rCurrent = Target
End Sub

----Placed in Module1---

Public rPrevious As Range
Public rCurrent As Range

Public Sub GoToPrevious()
If Not rPrevious Is Nothing Then Application.GoTo

rPrevious
End Sub

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Previous Worksheet

In an excel file I am using several sheets as menu forms (control forms) to
some 67 metrics. This code provides a means to transet between worsheets as
a command button named "Previous" which will return you to the last worksheet
you were at. The present code only knows those two conditions 'present and
previous'. It seems the code will goto the last cell at some point then the
command button is lost until you reprime it by manually going to another
worksheet.

What I am looking for is code that will stackup several worksheets so one
may travel between the sheets and the code would remember say 20 previous
sheets.

This nice but I hope someone can beef it up a little.

" wrote:

what is this code suppose to do???

-----Original Message-----
I copied this a few days ago and it works fine, sorry

that I cannot offer
thanks to the author. I failed to write down names.

Please I need everyones help. Thanks

Questions;
1. This code works 90% of the time, but then it locks, I

can manually
restart it by using the sheet tags and going to any other

sheet, then click
on the command button to revert back to the previous

sheet and then that
button starts working again. WHY ?? Whats the fix ???????

2. How can this code be change to stack up to 5 previous

worksheets in
memory, rather than flipping back and forth between the

two same sheets ??

Previous Worksheet code;
----Placed in Thisworkbook----

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Not rCurrent Is Nothing Then Set rPrevious =

rCurrent
Set rCurrent = ActiveCell
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As

Object, ByVal Target
As Excel.Range)
If Not rCurrent Is Nothing Then Set rPrevious =

rCurrent
Set rCurrent = Target
End Sub

----Placed in Module1---

Public rPrevious As Range
Public rCurrent As Range

Public Sub GoToPrevious()
If Not rPrevious Is Nothing Then Application.GoTo

rPrevious
End Sub

.


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
Go back to previous worksheet BarryL New Users to Excel 2 May 5th 05 01:38 AM
Return to previous worksheet after code pastes in another worksheet? Ron[_28_] Excel Programming 4 September 4th 04 07:52 PM
Selecting previous worksheet Carolyne[_2_] Excel Programming 2 May 20th 04 12:05 AM
Selecting previous worksheet Carolyne[_2_] Excel Programming 5 May 19th 04 01:49 PM
reference to previous worksheet Daniel Lidström Excel Programming 2 December 16th 03 07:34 PM


All times are GMT +1. The time now is 11:05 PM.

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"