Hello all
The following code works as two individual parts, one to trap the errors and one to display the "are you sure" type message.
Sub checkit()
Dim cont As range
For Each cont In range("stuff2")
On Error Resume Next
iAnswer = MsgBox("A value has been deleted or removed from the central workbook. Please click OK to delete or Cancel if you are unsure.", vbOKCancel)
If iAnswer = vbOK Then range("stuff2").SpecialCells(xlFormulas, xlErrors).EntireRow.Delete Else End
Next cont
On Error GoTo 0
End Sub
Unfortunately as one code it doesnt trap errors it just launches into the msgbox irrespective of any error present.
I need this to obviously trap the error and make sure the user wants to go on and delete the row.
It is set to go through a named range stuff2
Perhaps I have mixed too much together without considering each bit of codes effect on the other.
Anyones help would be great.
Many thanks in advance
Neil
The following code works as two individual parts, one to trap the errors and one to display the "are you sure" type message.
Sub checkit()
Dim cont As range
For Each cont In range("stuff2")
On Error Resume Next
iAnswer = MsgBox("A value has been deleted or removed from the central workbook. Please click OK to delete or Cancel if you are unsure.", vbOKCancel)
If iAnswer = vbOK Then range("stuff2").SpecialCells(xlFormulas, xlErrors).EntireRow.Delete Else End
Next cont
On Error GoTo 0
End Sub
Unfortunately as one code it doesnt trap errors it just launches into the msgbox irrespective of any error present.
I need this to obviously trap the error and make sure the user wants to go on and delete the row.
It is set to go through a named range stuff2
Perhaps I have mixed too much together without considering each bit of codes effect on the other.
Anyones help would be great.
Many thanks in advance
Neil