Hi Guys,
I have this private sub that gets stuck on an endless loop, error handling just shows the first line?
I have this private sub that gets stuck on an endless loop, error handling just shows the first line?
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' Change the cell colour and set the update flag to 1
Dim rngtemp1 As Range
Dim rngTemp3 As Range
Dim wsTemp As Worksheet
Dim lngLastRow As Long
Dim changedCell As Range
If ThisWorkbook.ActiveSheet.Name = "Network Data" Then
Set wsTemp = ThisWorkbook.Worksheets("Network Data")
lngLastRow = wsTemp.Range("D" & Rows.Count).End(xlUp).Row
Set rngtemp1 = wsTemp.Range("h2:Z" & Trim(Str(lngLastRow)))
If Not Intersect(Target, rngtemp1) Is Nothing Then
With Target.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
Set rngTemp3 = Intersect(Target.EntireRow, wsTemp.Range("AD:AD"))
rngTemp3.Value = "1"
End With
End If
End If
If Not Intersect(Range("V:V"), Target) Is Nothing Then
For Each changedCell In Intersect(Range("V:V"), Target).Cells
If changedCell.Offset(0, -3).Value = changedCell.Value Then
changedCell.Offset(0, 1).Value = "Completed"
End If
Next changedCell
End If
End Sub