I'm using the following code to switch the entry of a cell to upper case and change the formatting based on its contents:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("D3:AK100")) Is Nothing Then
Target(1).Value = UCase(Target(1).Value)
Select Case Target
Case "N"
icolor = 3
isbold = True
Case "A"
icolor = 46
isbold = True
Case "M"
BackColor = 15
isbold = False
Case "NLE"
BackColor = 15
isbold = False
Case Else
End Select
Target.Interior.ColorIndex = BackColor
Target.Font.ColorIndex = icolor
Target.Font.Bold = isbold
End If
Application.EnableEvents = True
End Sub
This works wonderfully, until I drag to fill multiple cells, then it throws an error and I have to close excel completely and re-open before it will work at all.
I want to be able to drag to fill without crashing the code, any ideas?
Bookmarks