LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet_change event problems

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
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_Change Event thewizz Excel Programming 4 November 2nd 07 02:15 PM
Worksheet_Change event Sandy Excel Programming 3 August 4th 07 12:23 PM
How do I change a Worksheet_change event to a beforesave event? Tueanker Excel Programming 5 June 29th 07 03:00 PM
Worksheet_Change event Tom Ogilvy Excel Programming 1 January 24th 07 06:56 PM
Worksheet_Change Event cmcfalls[_4_] Excel Programming 3 April 12th 04 09:47 PM


All times are GMT +1. The time now is 12:33 PM.

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

About Us

"It's about Microsoft Excel"