For what reason is the below worksheet change crashing excel. this can easily be done with a formula however, i have a double click function that does not carry the formula.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LastRow As Long
Dim G As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For G = 2 To LastRow
If Range("E" & G).Value = "99" Then
Range("G" & G).Value = "99"
ElseIf Range("E" & G).Value = "95" Then
Range("G" & G).Value = "95"
ElseIf Range("E" & G).Value = "991" Then
Range("G" & G).Value = "991"
ElseIf Range("E" & G).Value = "71" Then
Range("G" & G).Value = "71"
ElseIf Range("E" & G).Value = "40" Then
Range("G" & G).Value = "40"
End If
Next G
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LastRow As Long
Dim G As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For G = 2 To LastRow
If Range("E" & G).Value = "99" Then
Range("G" & G).Value = "99"
ElseIf Range("E" & G).Value = "95" Then
Range("G" & G).Value = "95"
ElseIf Range("E" & G).Value = "991" Then
Range("G" & G).Value = "991"
ElseIf Range("E" & G).Value = "71" Then
Range("G" & G).Value = "71"
ElseIf Range("E" & G).Value = "40" Then
Range("G" & G).Value = "40"
End If
Next G
End Sub
Last edited: