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

I have declared a subroutine:

Private Sub Worksheet_Activate()

with the belief that this is executed when the sheet or workbook opens
However, when I have closed the workbook and re-opened, the code ha
not been executed. I have put Debug.Print statements at the beginnin
and end but Excel doesn't even enter this code. Are there an
circumstances under which this might happen

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default Worksheet_Activate

Did you do this in the sheet code module or a general module?
It must be in the sheet's module.

Pozzo < wrote:

I have declared a subroutine:

Private Sub Worksheet_Activate()

with the belief that this is executed when the sheet or workbook opens.
However, when I have closed the workbook and re-opened, the code has
not been executed. I have put Debug.Print statements at the beginning
and end but Excel doesn't even enter this code. Are there any
circumstances under which this might happen?


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet_Activate

Yes, it is in the module for that sheet.


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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet_Activate

I need to have this code run specifically for this sheet, though, so
can't attach it to a workbook event.

I've just found out that the code executes when a move away to anothe
sheet and then come back, just not when the workbook opens with thi
sheet as the active sheet. Is this how it is supposed to work

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Worksheet_Activate

The ThisWorkbook event only activates a macro it doesn't restrict the scope of the macro (i.e. you can use it to activate a macro to run formulas on sheet1)

Yes it will activate if you unselect the sheet and re-select it. That's how it is supposed to work. If you need to run when open the workbook you need the "ThisWorkbook_Open()" event. You could go to another sheet and save it. When you open the workbook again you would be forced to select that sheet again, hence, activate the event (I don't recommend that)

----- Pozzo wrote: ----

I need to have this code run specifically for this sheet, though, so
can't attach it to a workbook event

I've just found out that the code executes when a move away to anothe
sheet and then come back, just not when the workbook opens with thi
sheet as the active sheet. Is this how it is supposed to work


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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet_Activate

Ok. Thanks for your help. I think I'm clear now

--
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
Worksheet_Activate not working for multiple cells [email protected] Excel Discussion (Misc queries) 0 December 28th 05 04:15 PM
Worksheet_Activate Jim Carlock[_2_] Excel Programming 2 September 25th 03 12:47 AM
Why wouldn't calling the Activate sub for a sheet automatically call that sheet's Worksheet_Activate() sub? Scott Lyon Excel Programming 3 August 19th 03 03:03 PM
Automation Procedure with Worksheet_Activate If Excel Programming 2 July 11th 03 12:15 AM


All times are GMT +1. The time now is 10:18 PM.

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

About Us

"It's about Microsoft Excel"