LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default On Error action inconsistent

Through VBA, I enabling the use to add another worksheet and and change it's
name. I'm hoped to use the "On Error" trapping to continue looping asking
for valide worksheet name. My problem is that the error is trapped only
once. The second time around the error no longer trapped. What's the
correct way to use "On Error" to achieve my goal? Here's the code. Thanks
- Pat

Sub AddWorkSheet()
Dim vResponse As Variant

Sheet1.Copy After:=Sheets(Sheets.Count)

On Error GoTo BadName:
BadName:
vResponse = Trim(InputBox("New worksheet name? ", , ActiveSheet.Name))
If vResponse < "" Then
ActiveSheet.Name = vResponse
End If

On Error GoTo 0
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
inconsistent error message DJ in KC Excel Discussion (Misc queries) 3 February 12th 09 05:10 AM
Inconsistent error Stuart[_19_] Excel Programming 5 December 11th 04 04:43 PM
OLE action error thru automation Ste[_2_] Excel Programming 3 June 4th 04 09:01 AM
Action on Error No Name Excel Programming 2 February 27th 04 06:57 PM
Action on error Mike Excel Programming 2 February 27th 04 06:08 PM


All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"