Hi all,
Below is my code and it was running perfectly until I added the bolded underlined line below:
I could of course just take the line out but the point is I want to know why is this a debug error?
Thanks in advance.
Below is my code and it was running perfectly until I added the bolded underlined line below:
Rich (BB code):
Private Sub worksheet_change(ByVal target As Range)
Dim TRowNum As Integer
Dim LDTask As Integer
Dim PRange As Range
Dim lRow1 As Integer
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.EnableEvents = False
If Not Intersect(target, Columns("b")) Is Nothing Then
If UCase(target.Value) = "OK" And target.Offset(0, -1).Value <> 0 Then
TRowNum = target.Row
LDTask = Sheets("List - Completed tasks").Range("A65536").End(xlUp).Row + 1
With Sheets("List - Completed tasks")
.Unprotect Password:="der"
Sheets("List - Pending tasks").Rows(TRowNum).Copy
.Range("A" & LDTask).PasteSpecial Paste:=xlPasteValues
.Range("C" & LDTask).Value = Date
.Range("D" & LDTask).Value = Time()
.Protect Password:="der"
End With
Sheets("List - Pending tasks").Activate
Rows(TRowNum).Delete
With Sheets("Pivot - Completed tasks")
.Unprotect Password:="der"
.PivotTables("PivotTable1").PivotCache.Refresh
lRow1 = .Range("B65536").End(xlUp).Row
.Range("A5:E5").Copy
.Range("A6:E" & lRow1).PasteSpecial Paste:=xlPasteFormats
.Range("A4").Select
.Protect Password:="der"
End With
End If
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
I could of course just take the line out but the point is I want to know why is this a debug error?
Thanks in advance.