P
Pierre via OfficeKB.com
Hi experts,
I have the folowing code which worked fine in the past but now, nothing
happens when changing a cell in column D.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
Dim myRng As Range
Dim sForm As String
Set myRng = Intersect(Target, Range("D"))
If myRng Is Nothing Then
Exit Sub
End If
Application.EnableEvents = False
For Each myCell In myRng.Cells
sForm = "=if(OR(O4=""offerte"",O4=""afgesloten""),if(S4<>"""",S4*U4,0),
0)"
Me.Cells(myCell.Row, "V").Formula = Replace(sForm, 4, myCell.Row)
sForm = "=if(I4<>"""",Vlookup(I4,hulpblad!B2:C250,2),"""")"
Cells(Target.Row, "J").Formula = Replace(sForm, 4, Target.Row)
Next myCell
Application.EnableEvents = True
End Sub
any ideas?
thanks,
Pierre
I have the folowing code which worked fine in the past but now, nothing
happens when changing a cell in column D.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
Dim myRng As Range
Dim sForm As String
Set myRng = Intersect(Target, Range("D"))
If myRng Is Nothing Then
Exit Sub
End If
Application.EnableEvents = False
For Each myCell In myRng.Cells
sForm = "=if(OR(O4=""offerte"",O4=""afgesloten""),if(S4<>"""",S4*U4,0),
0)"
Me.Cells(myCell.Row, "V").Formula = Replace(sForm, 4, myCell.Row)
sForm = "=if(I4<>"""",Vlookup(I4,hulpblad!B2:C250,2),"""")"
Cells(Target.Row, "J").Formula = Replace(sForm, 4, Target.Row)
Next myCell
Application.EnableEvents = True
End Sub
any ideas?
thanks,
Pierre