Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
worksheet_calculate event changes worksheets, but shouldn't
Hi,
The code below is in the Sheet1 (Budget) Module: The user is entering data into the "Budget" worksheet. When this fires, it should hide some rows on the Categories worksheet. It does work ok, however, everytime a user enters a new figure on the Budget worksheet, it fires and momentarily flashes over to the Categories worksheet. It is quite distractive, especially when one has hundreds of figures to enter. I set a trap to stop it on the top line of this code - the Private Sub Worksheet_Calculate() line. Then, when I enter a new number on the Budget page, it fires, and stops on this top line of code. At that point, before any of the code below has run, the screen has already flashed over to the Categories page and waits there until I hit F8. Then when I hit F8 twice, after it executes the second line (screen updating = false), then it switches back to the Budget worksheet where it should be and remains there. To be more precise, when it flashes to the Categories worksheet, what actually shows on the screen is: Top half of screen is the Budget page Bottom half of screen is the Categories page. It's almost like when a partial refresh happens sometimes. The Budget tab is still active, not the Categories tab. I'd surely appreciate any ideas you may have to stop this flashing over. Thanks, Harold Private Sub Worksheet_Calculate() 'this hides the message rows on Categories page if Budget Total is greater than 1 Application.ScreenUpdating = False Sheets("Categories").Unprotect Password:="xxx" Application.EnableEvents = False If Sheets("Budget").Range("J111").Value 1 Then Sheets("Categories").Rows("32:33").EntireRow.Hidde n = False Else If Sheets("Budget").Range("E30").Value = 0 Then Sheets("Categories").Rows("32:33").EntireRow.Hidde n = True End If End If Application.EnableEvents = True Application.ScreenUpdating = False Sheets("Categories").Protect Password:="xxx" End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet_Calculate event and input data | Excel Programming | |||
Worksheet_Calculate event problem | Excel Programming | |||
A procedure should run when one cell switch between false/true - but not with worksheet_calculate or change event... | Excel Programming | |||
dynamically changing chart y axis using spin buttons and worksheet_calculate event | Excel Programming | |||
worksheet_calculate **help** | Excel Programming |