tools
06-01-2008, 10:36 PM
Hi all,
when i paste some values (rows) from one excel sheet to another the worksheet_change event is not triggered properly
Here is the code that i have written
Is there any other event which could trigger this .?
Private Sub Worksheet_Change(ByVal Target As Range)
Sheet1.Unprotect
On Error Resume Next
Dim rFound As Range
Dim rowlast
If Not Intersect(Target, Range("D4,U4,C10:C100,E10:E100,G10:G100")) Is Nothing Then
If Target.Column = 4 Then
Set rFound = Sheets("TEMP").Cells.Find(What:=Target.Value, After:=Sheets("TEMP").Range("D1"), LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
Target.Offset(0, 17).Value = rFound.Offset(0, 17).Value
End If
End If
Sheet1.Protect
If Sheet1.Protection.AllowInsertingRows = False Then
Sheet1.Protect AllowInsertingRows:=True
End If
End Sub
when i paste some values (rows) from one excel sheet to another the worksheet_change event is not triggered properly
Here is the code that i have written
Is there any other event which could trigger this .?
Private Sub Worksheet_Change(ByVal Target As Range)
Sheet1.Unprotect
On Error Resume Next
Dim rFound As Range
Dim rowlast
If Not Intersect(Target, Range("D4,U4,C10:C100,E10:E100,G10:G100")) Is Nothing Then
If Target.Column = 4 Then
Set rFound = Sheets("TEMP").Cells.Find(What:=Target.Value, After:=Sheets("TEMP").Range("D1"), LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
Target.Offset(0, 17).Value = rFound.Offset(0, 17).Value
End If
End If
Sheet1.Protect
If Sheet1.Protection.AllowInsertingRows = False Then
Sheet1.Protect AllowInsertingRows:=True
End If
End Sub