Hello all
I'm creating a holiday book for work,
In the VBA I've I have a work sheet change function that's adds a comment and changes the font to uppercase to every cell that is edited, that works fine.
But when press delete on a couple of cells while im still playing I get a
Question 1 is there any way I can stop the VBA from crashing?
Question 2 is can I press a F key or something to reset the vba because im having to keep logging out and back in every time
many thanks Jason
I'm creating a holiday book for work,
In the VBA I've I have a work sheet change function that's adds a comment and changes the font to uppercase to every cell that is edited, that works fine.
But when press delete on a couple of cells while im still playing I get a
runtime error '13' Type Mismatch
Question 1 is there any way I can stop the VBA from crashing?
Question 2 is can I press a F key or something to reset the vba because im having to keep logging out and back in every time
many thanks Jason
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'changes the cells to UPPERCASE
If Intersect(Target, Range("A1:AH100")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Target = UCase(Target)
Application.EnableEvents = True
'Adds a comment box to each cell when somthing is added to the cell
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Not Target.Comment Is Nothing Then Target.Comment.Delete
Target.AddComment Text:=Application.UserName & vbNewLine & Date & vbNewLine & Time
Target.Comment.Shape.TextFrame.Characters(1, Len(Application.UserName)).Font.Bold = True
End Sub