2
 Excel - A macro to create and name worksheets based on a list June 2014  Excel - A macro to create and name worksheets based on a list Issue Solution  Issue I need a macro that can automat icall y create and rename wo rksheets, based on a list that exists in another sheet ("Summary") of t he same workbook? Th e li st begins at cell A10. How can this be implemented under Excel? Solution Try this: Sub CreateSheetsFromAList( ) Dim MyCell As Range, MyRange As Range Set MyRange = Shee ts( "Summary").Range("A10") Set MyRange = Range(MyRange, MyRange.End(xlDown)) For Each MyCell In MyRange Sheets.Add After:= Sheets(Sheets. Count) 'creates a new worksheet Sheets(Sheets. Count).Name = MyCell.Value ' renames the new worksheet Next MyCell End Sub Thanks to Ivan-hoe for this tip.

Excel a Macro to Create and Name Worksheets Based on a List 27361 Mi638z

Embed Size (px)

DESCRIPTION

ok

Citation preview

  • Excel - A macro to create and nameworksheets based on a listJune 2014

    Excel - A macro to create and nameworksheets based on a list

    IssueSolution

    IssueI need a macro that can automatically create and rename worksheets, based on alist that exists in another sheet ("Summary") of the same workbook? The list begins at cell A10.How can this be implemented under Excel?

    SolutionTry this:Sub CreateSheetsFromAList() Dim MyCell As Range, MyRange As Range Set MyRange = Sheets("Summary").Range("A10") Set MyRange = Range(MyRange, MyRange.End(xlDown))

    For Each MyCell In MyRange Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet Next MyCell End Sub Thanks to Ivan-hoe for this tip.

  • This document entitled Excel - A macro to create and name worksheets based on a list from Kioskea(en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page,under the conditions stipulated by the license, as this note appears clearly.