Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jim,
This solves the problem! Thank you. Gary "Jim Rech" wrote in message ... I didn't try to run your code but it looks to me that the problem may be that the formatting is done to the "activesheet". The sheet deactivate event runs after you've left a sheet. So another sheet is therefore active. You're formatting the new sheet, not the old one. I'd try passing the sheet to Calc_New_Expenses like : Private Sub Workbook_SheetDeactivate(ByVal Sh As Object) If Sh.Name = "Construction Expenses" Or Sh.Name = "Misc Expenses" Then Calc_New_Expenses Sh End If End Sub Sub Calc_New_Expenses(Sh as Worksheet) Dim MyRange As Range, MyRows As Integer, ThisRow As Integer ''other code With Sh Set MyRange = .UsedRange MyRows = MyRange.Rows.Count 'etc End With End Sub Jim Rech Excel MVP |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If I have my sheets protected will that prevent me running a macro to hide certain sells? | Excel Worksheet Functions | |||
routine to refresh all pivots in WB acroos several sheets | Excel Discussion (Misc queries) | |||
Prevent A Macro From Running If SpreadSheet is Filtered | Excel Worksheet Functions | |||
Prevent running macro upon closing Excel | Excel Programming | |||
Prevent users from running macros | Excel Programming |