snowdyce
07-15-2014, 12:46 PM
Hello Experts. I am working on an excel with VBA code that someone else built. It currently works fine. I am trying to enhance it by adding some simple code. As soon as I add one line, and run it, Excel crashes completely. I don't get the debug error or anything, a pure crash, and it has been consistent. Tried restarting Excel and my computer just in case. I have no idea what is causing this. I did notice that this workbook has some code on the Sheet as well as the Model. Here is the code on the sheet, could this be the issue? I have always put all my code into the Module. I noticed it because when i tried to Debug it, it kept bouncing from the module to this code. I am unfamiliar with Case, I am a new VBA user.
Public Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Row
Case 4
Target.Font.ColorIndex = 1
Case 13
'MsgBox (" Worksheet Change")
If ActiveSheet.Cells(6, 1).Value = 1 Then
Target.Font.ColorIndex = 1
Else
Target.Font.ColorIndex = 3
Target.Interior.ColorIndex = 2
Target.NumberFormat = "###,##0"
End If
End Select
End Sub
Thanks,
Public Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Row
Case 4
Target.Font.ColorIndex = 1
Case 13
'MsgBox (" Worksheet Change")
If ActiveSheet.Cells(6, 1).Value = 1 Then
Target.Font.ColorIndex = 1
Else
Target.Font.ColorIndex = 3
Target.Interior.ColorIndex = 2
Target.NumberFormat = "###,##0"
End If
End Select
End Sub
Thanks,