anand3dinesh
Board Regular
- Joined
- Dec 19, 2019
- Messages
- 137
- Office Version
- 365
- Platform
- Windows
Hello my dear friends,
i have this Worksheet_Change event, i do not know what is exact error but it keeps saying there is an error.
what i am trying to do is, if anyone deletes OvarAll shape then macro will throw an error right so uppon error macro should go and insert Ovel shape and rename it as OverAll.
if i take out on error goto ErrHangle line, macro works fine but i can't make macro to insert Ovel shape as i explained above.
my error hangling msg box simply shows blank message
below is my code
Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Range("G21")
On Error GoTo ErrHandle
If Target.Value = 1 Then
Sheets("Summary").Shapes("OverAll").Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf Target.Value = 2 Then
Sheets("Summary").Shapes("OverAll").Fill.ForeColor.RGB = RGB(255, 192, 0)
ElseIf Target.Value = 3 Then
Sheets("Summary").Shapes("OverAll").Fill.ForeColor.RGB = RGB(0, 176, 80)
Else
Sheets("Summary").Shapes("OverAll").Fill.ForeColor.RGB = RGB(255, 255, 255)
End If
ErrHandle:
MsgBox Err.Description
End Sub
i have this Worksheet_Change event, i do not know what is exact error but it keeps saying there is an error.
what i am trying to do is, if anyone deletes OvarAll shape then macro will throw an error right so uppon error macro should go and insert Ovel shape and rename it as OverAll.
if i take out on error goto ErrHangle line, macro works fine but i can't make macro to insert Ovel shape as i explained above.
my error hangling msg box simply shows blank message
below is my code
Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Range("G21")
On Error GoTo ErrHandle
If Target.Value = 1 Then
Sheets("Summary").Shapes("OverAll").Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf Target.Value = 2 Then
Sheets("Summary").Shapes("OverAll").Fill.ForeColor.RGB = RGB(255, 192, 0)
ElseIf Target.Value = 3 Then
Sheets("Summary").Shapes("OverAll").Fill.ForeColor.RGB = RGB(0, 176, 80)
Else
Sheets("Summary").Shapes("OverAll").Fill.ForeColor.RGB = RGB(255, 255, 255)
End If
ErrHandle:
MsgBox Err.Description
End Sub