View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Unhide sheet, copy and rename new sheets from list, rehide sheet

Hi Howard,

Am Sat, 12 Oct 2013 05:48:56 -0700 (PDT) schrieb Howard:

For Each rngC In Sheets("Sheet1").Range("MyNewList")


for a range name (workbook)

Sub CopyMe()
Dim rngC As Range
Application.ScreenUpdating = False
ActiveWorkbook.Names.Add "MyNewList", _
RefersTo:="=Offset(Sheet1!$A$1,,,CountA(Sheet1!$A: $A))"
With Sheets("CopyMe")
.Visible = True
For Each rngC In Range("MyNewList")
If Not SheetExists(rngC.Value) Then
.Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = rngC
End If
Next
.Visible = False
End With
Application.ScreenUpdating = True
End Sub

If you have a range name (workbook scope)
and not all cells are filled try:
Sub CopyMe2()
Dim rngC As Range
Application.ScreenUpdating = False
With Sheets("CopyMe")
.Visible = True
For Each rngC In Range("MyNewList")
If Len(rngC) 0 Then
If Not SheetExists(rngC.Value) Then
.Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = rngC
End If
End If
Next
.Visible = False
End With
Application.ScreenUpdating = True
End Sub

Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2