I'm creating and renaming sheets based on the customer name in a cell (truncated). Some of the customer names have colons, which are illegal, causing error 1004.
The error code:
On Error GoTo fixname
Here's the rename code:
TryNow: Sheets(cursheet).Select
Sheets(cursheet).Name = Cname
Sheets(Mainsheet).Select
Here's the error handler:
fixname:
If Err.Number = 1004 Then
Cname = InputBox("Fix Customer Name", "Naming Error", Cname)
GoTo TryNow
Else
MsgBox Err.Number
End If
The first time it comes across "EB: MERR". I get the input box, fix it and it works great.
The second time it encounters "RH: BROA" and the error handler doesn't handle it. I get the fatal error DB instead, saying "Run Time Error 1004".
What do you think of that? ?
The error code:
On Error GoTo fixname
Here's the rename code:
TryNow: Sheets(cursheet).Select
Sheets(cursheet).Name = Cname
Sheets(Mainsheet).Select
Here's the error handler:
fixname:
If Err.Number = 1004 Then
Cname = InputBox("Fix Customer Name", "Naming Error", Cname)
GoTo TryNow
Else
MsgBox Err.Number
End If
The first time it comes across "EB: MERR". I get the input box, fix it and it works great.
The second time it encounters "RH: BROA" and the error handler doesn't handle it. I get the fatal error DB instead, saying "Run Time Error 1004".
What do you think of that? ?