Hello,
I'm developing a code that is suppose to convert the NumberFormatt of a number depending on it's unit (m3 or L)
My code works for the most part but once I try to delete more than one cell at a time, the program crashes and a debugger window opens saying "run time error 13: Type Mismatch". Below I posted my code can anyone help remove this message or is there something wrong with my code?
'converts decmial places depending on L/m3
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngIntersect As Range
Set rngIntersect = Intersect(Range("T:T"), Target)
If Not rngIntersect Is Nothing Then
If Target.Value = "L" Then DEBUGGER POINTS TO THIS LINE
Target.Offset(0, -1).NumberFormat = "0"
Else
Target.Offset(0, -1).NumberFormat = "0.000"
End If
End If
End Sub
I'm developing a code that is suppose to convert the NumberFormatt of a number depending on it's unit (m3 or L)
My code works for the most part but once I try to delete more than one cell at a time, the program crashes and a debugger window opens saying "run time error 13: Type Mismatch". Below I posted my code can anyone help remove this message or is there something wrong with my code?
'converts decmial places depending on L/m3
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngIntersect As Range
Set rngIntersect = Intersect(Range("T:T"), Target)
If Not rngIntersect Is Nothing Then
If Target.Value = "L" Then DEBUGGER POINTS TO THIS LINE
Target.Offset(0, -1).NumberFormat = "0"
Else
Target.Offset(0, -1).NumberFormat = "0.000"
End If
End If
End Sub