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

Greetings,

I recently broke a worksheet off of a large workbook and made it into
a single sheet workbook. I kept the sheet code for the clearing
process. This code is located in the sheet code area. After clearing
all entries the code changed the color of a button and two cells (to
announce that it has finished clearing. Big sheet - took time).

This part is working. It is the second part that stopped working
after the break off!

This second part is set to trigger when the sheet is activated. It
changes the color of the button and the same two cells back to their
original color. It is not triggering.

Here are the subs:

================================================== ====

Private Sub ButtonClearAll_Click()
If MsgBox("Do you want to Clear ALL data from " & _
"this sheet?", vbYesNo + vbDefaultButton1) = _
vbYes Then ClearSheet
End Sub
__________________________________________________ ________

Sub ClearSheet()
Range("rInv").Value = vbNullString
ButtonClearAll.BackColor = &HFF00&
Range("C1:C2").Interior.ColorIndex = 4
End Sub
__________________________________________________ ________

Private Sub Worksheet_Activate()
ButtonClearAll.BackColor = &HFFFF&
Range("C1:C2").Interior.ColorIndex = 6
Calculate
End Sub
================================================== ==

Range("rInv") is the range cleared. ButtonClearAll is the button that
starts the procedure and Range("C1:C2") are the two cells that have
the color change to signal procedure completion.

Did I miss something?

Anybody see any reason why the Worksheet_Activate event is not
working?

Any help will be appreciated.

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Code Stopped Working

It works fine for me as written. If it is only the activation piece you might
want to copy the code, delete the activation sub, then create a new one by
selecting worksheet in the left dropdown and activate in the right one and
pasting the code in there.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Minitman" wrote:

Greetings,

I recently broke a worksheet off of a large workbook and made it into
a single sheet workbook. I kept the sheet code for the clearing
process. This code is located in the sheet code area. After clearing
all entries the code changed the color of a button and two cells (to
announce that it has finished clearing. Big sheet - took time).

This part is working. It is the second part that stopped working
after the break off!

This second part is set to trigger when the sheet is activated. It
changes the color of the button and the same two cells back to their
original color. It is not triggering.

Here are the subs:

================================================== ====

Private Sub ButtonClearAll_Click()
If MsgBox("Do you want to Clear ALL data from " & _
"this sheet?", vbYesNo + vbDefaultButton1) = _
vbYes Then ClearSheet
End Sub
__________________________________________________ ________

Sub ClearSheet()
Range("rInv").Value = vbNullString
ButtonClearAll.BackColor = &HFF00&
Range("C1:C2").Interior.ColorIndex = 4
End Sub
__________________________________________________ ________

Private Sub Worksheet_Activate()
ButtonClearAll.BackColor = &HFFFF&
Range("C1:C2").Interior.ColorIndex = 6
Calculate
End Sub
================================================== ==

Range("rInv") is the range cleared. ButtonClearAll is the button that
starts the procedure and Range("C1:C2") are the two cells that have
the color change to signal procedure completion.

Did I miss something?

Anybody see any reason why the Worksheet_Activate event is not
working?

Any help will be appreciated.

-Minitman

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Code Stopped Working

In the Immediate window, type this

Application.EnableEvents = True

And try it again.
--
HTH,
Barb Reinhardt



"Minitman" wrote:

Greetings,

I recently broke a worksheet off of a large workbook and made it into
a single sheet workbook. I kept the sheet code for the clearing
process. This code is located in the sheet code area. After clearing
all entries the code changed the color of a button and two cells (to
announce that it has finished clearing. Big sheet - took time).

This part is working. It is the second part that stopped working
after the break off!

This second part is set to trigger when the sheet is activated. It
changes the color of the button and the same two cells back to their
original color. It is not triggering.

Here are the subs:

================================================== ====

Private Sub ButtonClearAll_Click()
If MsgBox("Do you want to Clear ALL data from " & _
"this sheet?", vbYesNo + vbDefaultButton1) = _
vbYes Then ClearSheet
End Sub
__________________________________________________ ________

Sub ClearSheet()
Range("rInv").Value = vbNullString
ButtonClearAll.BackColor = &HFF00&
Range("C1:C2").Interior.ColorIndex = 4
End Sub
__________________________________________________ ________

Private Sub Worksheet_Activate()
ButtonClearAll.BackColor = &HFFFF&
Range("C1:C2").Interior.ColorIndex = 6
Calculate
End Sub
================================================== ==

Range("rInv") is the range cleared. ButtonClearAll is the button that
starts the procedure and Range("C1:C2") are the two cells that have
the color change to signal procedure completion.

Did I miss something?

Anybody see any reason why the Worksheet_Activate event is not
working?

Any help will be appreciated.

-Minitman

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Code Stopped Working

You said you copied the sheet into a one-sheet workbook? My guess is that
the Worksheet_Activate event never gets fired because for that event to fire
you must come to that sheet from another sheet... something that you don't
have! :)

"Minitman" wrote:

Greetings,

I recently broke a worksheet off of a large workbook and made it into
a single sheet workbook. I kept the sheet code for the clearing
process. This code is located in the sheet code area. After clearing
all entries the code changed the color of a button and two cells (to
announce that it has finished clearing. Big sheet - took time).

This part is working. It is the second part that stopped working
after the break off!

This second part is set to trigger when the sheet is activated. It
changes the color of the button and the same two cells back to their
original color. It is not triggering.

Here are the subs:

================================================== ====

Private Sub ButtonClearAll_Click()
If MsgBox("Do you want to Clear ALL data from " & _
"this sheet?", vbYesNo + vbDefaultButton1) = _
vbYes Then ClearSheet
End Sub
__________________________________________________ ________

Sub ClearSheet()
Range("rInv").Value = vbNullString
ButtonClearAll.BackColor = &HFF00&
Range("C1:C2").Interior.ColorIndex = 4
End Sub
__________________________________________________ ________

Private Sub Worksheet_Activate()
ButtonClearAll.BackColor = &HFFFF&
Range("C1:C2").Interior.ColorIndex = 6
Calculate
End Sub
================================================== ==

Range("rInv") is the range cleared. ButtonClearAll is the button that
starts the procedure and Range("C1:C2") are the two cells that have
the color change to signal procedure completion.

Did I miss something?

Anybody see any reason why the Worksheet_Activate event is not
working?

Any help will be appreciated.

-Minitman

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Code Stopped Working

Hey Charlie,

Thanks for the reply.

Good catch, I broke that big workbook into 9 workbooks. This
particular workbook has 2 sheets (Enter and Input) all of the others
have only one, my mistake. It is when I go between sheet 1 (Enter) to
sheet 2 (Input) that the activate event is supposed to fire.

I have not had a chance to try out the solutions in the other two
replies yet, I will do that now.

-Minitman

On Wed, 27 Aug 2008 10:40:00 -0700, Charlie
wrote:

You said you copied the sheet into a one-sheet workbook? My guess is that
the Worksheet_Activate event never gets fired because for that event to fire
you must come to that sheet from another sheet... something that you don't
have! :)

"Minitman" wrote:

Greetings,

I recently broke a worksheet off of a large workbook and made it into
a single sheet workbook. I kept the sheet code for the clearing
process. This code is located in the sheet code area. After clearing
all entries the code changed the color of a button and two cells (to
announce that it has finished clearing. Big sheet - took time).

This part is working. It is the second part that stopped working
after the break off!

This second part is set to trigger when the sheet is activated. It
changes the color of the button and the same two cells back to their
original color. It is not triggering.

Here are the subs:

================================================== ====

Private Sub ButtonClearAll_Click()
If MsgBox("Do you want to Clear ALL data from " & _
"this sheet?", vbYesNo + vbDefaultButton1) = _
vbYes Then ClearSheet
End Sub
__________________________________________________ ________

Sub ClearSheet()
Range("rInv").Value = vbNullString
ButtonClearAll.BackColor = &HFF00&
Range("C1:C2").Interior.ColorIndex = 4
End Sub
__________________________________________________ ________

Private Sub Worksheet_Activate()
ButtonClearAll.BackColor = &HFFFF&
Range("C1:C2").Interior.ColorIndex = 6
Calculate
End Sub
================================================== ==

Range("rInv") is the range cleared. ButtonClearAll is the button that
starts the procedure and Range("C1:C2") are the two cells that have
the color change to signal procedure completion.

Did I miss something?

Anybody see any reason why the Worksheet_Activate event is not
working?

Any help will be appreciated.

-Minitman




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Code Stopped Working

Hey John,

Thanks for the reply.

That worked!!!

Thanks.

-Minitman

On Wed, 27 Aug 2008 10:15:01 -0700, John Bundy
(remove) wrote:

It works fine for me as written. If it is only the activation piece you might
want to copy the code, delete the activation sub, then create a new one by
selecting worksheet in the left dropdown and activate in the right one and
pasting the code in there.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Code Stopped Working

Hey Barb,

Thanks for the reply.

Since John's solution worked, it seems to have jarred something loose
in my excel program - now I can't seem to break it!!! <G I even
tried older versions of the app that caused the problem, no they are
working when they were not before.

Which means I have no way of testing your solution.

Also, I have not used the intermediate window and do not know how it
works or what it does. All I know is that it is there and when I go
into it, I don't understand what it is doing or how it will help me.
So I leave it alone.

-Minitman



On Wed, 27 Aug 2008 10:24:01 -0700, Barb Reinhardt
wrote:

In the Immediate window, type this

Application.EnableEvents = True

And try it again.


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
Can someone please tell me why my code stopped working??? Damil4real Excel Worksheet Functions 0 November 24th 09 10:49 PM
Add-in stopped working [email protected] Excel Programming 1 January 17th 07 05:49 PM
Code stopped working chris46521[_22_] Excel Programming 2 August 9th 06 03:05 PM
VB Stopped Working [email protected] Excel Worksheet Functions 1 April 28th 05 01:56 PM
Tab stopped working -- SCOTT-- Excel Programming 0 October 2nd 03 09:14 PM


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

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"