Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Can I disable Worksheet_activate???

Any Excel guru can help me??

I have three sheets (Sheet1, Sheet2, Sheet3).

Sheet2 has Worksheet_activate(Macro) on it.
Let say, I'm working on sheet1,if I move to Sheet2, then,
Worksheet_activate in sheet2 will be activates, right?
My question is, how can I (if possible) to disable the
Worksheet_activate to run in sheet2 if I move from sheet3 to sheet2 ??
I just want the Worksheet_activate in sheet2 running, only if I move
from sheet1.
Thank you.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Can I disable Worksheet_activate???

I am not sure whether this is correct move sanctioned by mvps
in the intermediate window of vba I type
application.enableevents=false
and hit enter
then after my work isover i again type in the intermesdiate window
application.enableevents=true
and then hit enter.
so that the worksheets activate macro of sheet2 can now work.

try this and see

=======================================
broogle wrote in message
oups.com...
Any Excel guru can help me??

I have three sheets (Sheet1, Sheet2, Sheet3).

Sheet2 has Worksheet_activate(Macro) on it.
Let say, I'm working on sheet1,if I move to Sheet2, then,
Worksheet_activate in sheet2 will be activates, right?
My question is, how can I (if possible) to disable the
Worksheet_activate to run in sheet2 if I move from sheet3 to sheet2 ??
I just want the Worksheet_activate in sheet2 running, only if I move
from sheet1.
Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can I disable Worksheet_activate???


You can use the *Private Sub Worksheet_Deactivate()* in all sheets
to set the a global var.
Then you can check in *Private Sub Worksheet_Activate()* of sheet2
where you are comming from.
And you can deside to run code if you're from sheet1.

Jeroen


--
Kaak
------------------------------------------------------------------------
Kaak's Profile: http://www.excelforum.com/member.php...fo&userid=7513
View this thread: http://www.excelforum.com/showthread...hreadid=383017

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Can I disable Worksheet_activate???

This is the sort of code Jeroen was referring to. Not that I use the
worksheet codename not name, in case a user gets cute and changes the name

Public LastSheet As String

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.CodeName = "Sheet2" Then
If LastSheet = "Sheet3" Then
'ok, so let go
Else
Worksheets(ThisWorkbook.VBProject.VBComponents(Las tSheet) _
.Properties("Name").Value).Activate
End If
End If
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
LastSheet = Sh.CodeName
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

"Kaak" wrote in message
...

You can use the *Private Sub Worksheet_Deactivate()* in all sheets
to set the a global var.
Then you can check in *Private Sub Worksheet_Activate()* of sheet2
where you are comming from.
And you can deside to run code if you're from sheet1.

Jeroen


--
Kaak
------------------------------------------------------------------------
Kaak's Profile:

http://www.excelforum.com/member.php...fo&userid=7513
View this thread: http://www.excelforum.com/showthread...hreadid=383017



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
Worksheet_Activate Not Called When Opening Workbook Gaston Excel Programming 6 October 29th 04 09:49 PM
Private Sub Worksheet_Activate() Teodor Bobochikov Excel Programming 1 September 28th 04 11:03 AM
Worksheet_Activate Pozzo Excel Programming 5 June 7th 04 07:39 PM
Worksheet_Activate Jim Carlock[_2_] Excel Programming 2 September 25th 03 12:47 AM
Automation Procedure with Worksheet_Activate If Excel Programming 2 July 11th 03 12:15 AM


All times are GMT +1. The time now is 12:35 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"