View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default copy Sheet and rename it!

Sub JohnSmith()
Dim myName As String
Dim SpecName As String
Dim CopyName As String

CopyName = "Existing Sheet Name to Copy"
SpecName = "Specific Name to look for"

On Error GoTo MakeSheet
myName = Worksheets(SpecName).Name
Exit Sub

MakeSheet:
Worksheets(CopyName).Copy _
After:=Sheets(ActiveSheet.Index)
ActiveSheet.Name = SpecName

End Sub

HTH,
Bernie
MS Excel MVP

"John Smith " wrote in message
...
I need to make a small VB program in Excel that can do the following:

- See weather a Specific Sheet name exists - then do nothing.
- If it do not exist then:
- Copy an existing Sheet.
- Give it a new name.

Please help!


---
Message posted from http://www.ExcelForum.com/