View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Copy adjacent Sheet and name from a list

Hi Garry,

Am Sun, 07 Apr 2013 14:24:57 -0400 schrieb GS:

Sub CopyAndNameSheets()
Dim vNames, n&, lRow&
With Sheets("Summary")
lRow = .Cells(.Rows.Count, 3).End(xlUp).Row
vNames = .Range("C1:C" & lRow)
End With
For n = LBound(vNames) To UBound(vNames)
Sheets("Main Swb").Copy after:=Sheets("Main Swb")
ActiveSheet.Name = vNames(n, 1)
Next 'n
End Sub


you didn't know the structure of the table. So you have to change two
lines of your code:

lRow = 8 + WorksheetFunction.CountA([C9:C24])
vNames = .Range("C9:C" & lRow)


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