LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Create multiple sheet tabs from multiple cells.

Try this construct by Dave Peterson.

Assumes the cells are in column A of Sheet1

Sub CreateNameSheets()

Dim ListWks As Worksheet
Dim ListRng As Range
Dim myCell As Range

Set ListWks = Worksheets("Sheet1")
With ListWks
Set ListRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
'or Set ListRng = Selection
End With

For Each myCell In ListRng.Cells
Worksheets.Add
On Error Resume Next
ActiveSheet.Name = myCell.Value
If Err.Number < 0 Then
MsgBox "Please fix: " & ActiveSheet.Name
Err.Clear
End If
On Error GoTo 0
Next myCell

End Sub


Gord Dibben MS Excel MVP

On Wed, 14 Nov 2007 12:23:02 -0800, Giggly4g
wrote:

I think I'm missing something. I copied and pasted the code but it keeps
hanging up after adding the first worksheet. If I change the value of inX to
4 or 172 or some other number, it creates a worksheet for just that cell (A4
or A172) but stops with the follow error...

Run-time error "9":
Subscript out of range

Please help...

"JonR" wrote:

Here's some code that will go down from A1 to A? (until it runs into an empty
cell) on the "Master" sheet and will create and name sheet according to what
is in each cell.

HTH

JonR

Sub NewSheet()

'This assumes the cells you wish to name the sheets after are in Column A
'on the "Master" worksheet.
'inX is a variable used to count down the rows.


Dim inX As Integer

Dim stName As String

inX = 1

Do Until Cells(inX, 1).Value = ""

stName = Cells(inX, 1).Value

Sheets.Add

ActiveSheet.Name = stName

Worksheets("Master").Activate

inX = inX + 1

Loop

End Sub



"Robert Maddox" wrote:

Is it possible to make multple worksheets from a selection of multiple cells?
This would mean a selection of 10 cells would generate 10 sheets titled with
the cell conent.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I link cells, sheet to sheet, to recognize row deletions? LeeC Excel Discussion (Misc queries) 30 November 6th 09 10:26 PM
view excel sheet tabs in multiple rows gingerq Setting up and Configuration of Excel 2 June 27th 06 01:25 AM
Code to create tabs in single excel sheet deepa prabhakar Excel Discussion (Misc queries) 1 May 26th 06 10:15 AM
printing multiple sheet tabs to image file 0492-Examiner Excel Discussion (Misc queries) 0 October 19th 05 10:43 PM
linking multiple sheets to a summary sheet greg g Excel Discussion (Misc queries) 1 December 16th 04 07:43 AM


All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"