View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Howard Howard is offline
external usenet poster
 
Posts: 536
Default Copy adjacent Sheet and name from a list

On Sunday, April 7, 2013 11:24:57 AM UTC-7, GS wrote:
I tried to have a look at your file but it was no longer there!



While certain that Claus provided an excellent solution, I offer a

version that doesn't loop each range on "Summary" for the names of the

copied sheets.



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



--

Garry



Free usenet access at http://www.eternal-september.org

Classic VB Users Regroup!

comp.lang.basic.visual.misc

microsoft.public.vb.general.discussion


Hi Garry,

Always glad to see/hear your 'Double Eagle' worth of advice. (Where "Double Eagle" replaces "two cents")<g

Here is a new link to a newer version that has the sheet to be copied, "Main Swb", hidden.

I made simple additions to Claus's code and it seems to work quite well.

https://www.dropbox.com/s/vwq5ao0a8x...ox%20V 1.xlsm

I would assume I could add the Unhide / Hide code lines to your version and get the same results.

Howard