LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
MWS MWS is offline
external usenet poster
 
Posts: 53
Default Error Handling for Duplicate Worksheet Names

I have the following code that allows the user the option of creating a copy
of the active worksheet and then names the copied worksheet:

Private Sub cmdCopy_Click()
Dim sh As Worksheet
With ThisWorkbook ' or ActiveWorkbook
Set sh = .Worksheets.Add(After:= _
.Worksheets(.Worksheets.Count))
.Worksheets("Populate Scorecard....").Cells.Copy _
Destination:=sh.Cells
End With

sh.Name = Range("b2").Value

Issue: I would like to create some sort of error handling that if the user
is trying to copy a worksheet that was previously copied/named, abort the
copying process and return the user to another worksheet via GoTo.

Can anyone help?

Any and All Assistance Will Be Appreciated - Thanks In Advance

 
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
Duplicate Range Names by worksheet FlaAl Excel Discussion (Misc queries) 0 May 24th 06 05:14 PM
Finding/removing duplicate names in a worksheet Dave Excel Worksheet Functions 1 April 17th 06 08:05 PM
Duplicate names on copied worksheet Pat Conover Links and Linking in Excel 0 March 20th 06 11:36 AM
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM


All times are GMT +1. The time now is 11:10 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"