Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am creating budget templates that use the worksheet_change event to modify
formulas in other cells of the sheet. One sheet is for budget and other is for salaries. On the budget sheet everything works like it should, on the salary sheet the cell unlock is ignored and the update traps to my error routine. The column contains a drop-down validation that I am testing. Is there something I am missing? Here is a portion of the code that works on one sheet but not the other: Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range If Not (Target.Interior.ColorIndex = 39 Or Cells(Target.Row, 4).Value = "Specific") Then Exit Sub ' On error restore operation of this code, then disable events till we are done here On Error GoTo ErrHandler Application.EnableEvents = False ' Process each of the changed value in succession For Each rng In Target ' Setup the formulas based on the selected spreading means If rng.Column = 4 Then Select Case rng.Value Case "n/a" ' No Formulas for this row With Range("E" & rng.Row & ":P" & rng.Row) .Locked = False .Value = 0 .Locked = True End With Case "Even" ' Split the amount evenly across the year With Range("E" & rng.Row & ":P" & rng.Row) .Locked = False .Formula = "=$C" & rng.Row & "/12" .Locked = True End With Case "Front Qtr" ' Split the amount in the 1st month of each quarter For i = 1 To 12 With rng.Offset(0, i) .Locked = False If i Mod 3 = 1 Then .Formula = "=C" & rng.Row & "/4" Else .Value = 0 End If .Locked = True End With Next i |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Worksheet_Change Event | Excel Programming | |||
Worksheet_Change event | Excel Programming | |||
How do I change a Worksheet_change event to a beforesave event? | Excel Programming | |||
Worksheet_Change event | Excel Programming | |||
Worksheet_Change Event | Excel Programming |