Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default macro to create a worksheet for every name on a list?

I am making worksheets for each name on a list and would like to have a macro
that can do that. I created an example sheet to copy and I recorded this
macro but I don't know how to select names from a defined list and to get it
to keep creating new sheets for each name.

Can someone help?

TIA


Todd


Sub CreateSheets()

Sheets("ExampleSheet").Select
Sheets("ExampleSheet").Copy Befo=Sheets(18)
Sheets("ExampleSheet (2)").Select
Range("C21").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Supplier List").Select
Range("A25").Select
Selection.Copy
Sheets("ExampleSheet (2)").Select
Sheets("ExampleSheet (2)").Name = "Cutler Hammer "
Range("D20").Select
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default macro to create a worksheet for every name on a list?

Assuming the list is in A1:A10

For Each cell In range("A1:A10")
Worrksheets.Add(After:=Worksheets.Count).Name = cell.Value
Next cell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Todd" wrote in message
...
I am making worksheets for each name on a list and would like to have a

macro
that can do that. I created an example sheet to copy and I recorded this
macro but I don't know how to select names from a defined list and to get

it
to keep creating new sheets for each name.

Can someone help?

TIA


Todd


Sub CreateSheets()

Sheets("ExampleSheet").Select
Sheets("ExampleSheet").Copy Befo=Sheets(18)
Sheets("ExampleSheet (2)").Select
Range("C21").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Supplier List").Select
Range("A25").Select
Selection.Copy
Sheets("ExampleSheet (2)").Select
Sheets("ExampleSheet (2)").Name = "Cutler Hammer "
Range("D20").Select
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default macro to create a worksheet for every name on a list?

Bob..

I thought.. HEY s'thing new.. but alas it's a typo.

s/b

Sub foo()
Dim cell
For Each cell In Range("A1:A10")
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name = cell.Value
Next cell

End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Bob Phillips wrote :

Assuming the list is in A1:A10

For Each cell In range("A1:A10")
Worrksheets.Add(After:=Worksheets.Count).Name = cell.Value
Next cell

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default macro to create a worksheet for every name on a list?

Hi Jurgen,

As Harlan keeps telling me, we very little new here :-)!

Bob

"keepITcool" wrote in message
ft.com...
Bob..

I thought.. HEY s'thing new.. but alas it's a typo.

s/b

Sub foo()
Dim cell
For Each cell In Range("A1:A10")
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name = cell.Value
Next cell

End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Bob Phillips wrote :

Assuming the list is in A1:A10

For Each cell In range("A1:A10")
Worrksheets.Add(After:=Worksheets.Count).Name = cell.Value
Next cell



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default macro to create a worksheet for every name on a list?

I just MAY have found something new...

get a chart to accept a formula in a dataseries??


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Bob Phillips wrote :

Hi Jurgen,

As Harlan keeps telling me, we very little new here :-)!

Bob

"keepITcool" wrote in message
ft.com...
Bob..

I thought.. HEY s'thing new.. but alas it's a typo.

s/b

Sub foo()
Dim cell
For Each cell In Range("A1:A10")
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name =
cell.Value Next cell

End Sub




--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



Bob Phillips wrote :

Assuming the list is in A1:A10

For Each cell In range("A1:A10")
Worrksheets.Add(After:=Worksheets.Count).Name = cell.Value
Next cell



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro to create a worksheet for every name on a list?

Might want to check John Green's book, although I don't recall *exactly*
what you posted so I could be wrong.

--
Regards,
Tom Ogilvy

"keepITcool" wrote in message
ft.com...
I just MAY have found something new...

get a chart to accept a formula in a dataseries??


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Bob Phillips wrote :

Hi Jurgen,

As Harlan keeps telling me, we very little new here :-)!

Bob

"keepITcool" wrote in message
ft.com...
Bob..

I thought.. HEY s'thing new.. but alas it's a typo.

s/b

Sub foo()
Dim cell
For Each cell In Range("A1:A10")
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name =
cell.Value Next cell

End Sub




--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam


Bob Phillips wrote :

Assuming the list is in A1:A10

For Each cell In range("A1:A10")
Worrksheets.Add(After:=Worksheets.Count).Name = cell.Value
Next cell



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro to create a worksheet for every name on a list?

Sub CreateSheets()
Dim cell As Range, rng As Range
With Worksheets("Supplier List")
Set rng = .Range(.Range("A25"), .Range("A25").End(xlDown))
End With
For Each cell In rng
Sheets("ExampleSheet").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = cell.Value
Next
End Sub

--
Regards,
Tom Ogilvy

"Todd" wrote in message
...
I am making worksheets for each name on a list and would like to have a

macro
that can do that. I created an example sheet to copy and I recorded this
macro but I don't know how to select names from a defined list and to get

it
to keep creating new sheets for each name.

Can someone help?

TIA


Todd


Sub CreateSheets()

Sheets("ExampleSheet").Select
Sheets("ExampleSheet").Copy Befo=Sheets(18)
Sheets("ExampleSheet (2)").Select
Range("C21").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Supplier List").Select
Range("A25").Select
Selection.Copy
Sheets("ExampleSheet (2)").Select
Sheets("ExampleSheet (2)").Name = "Cutler Hammer "
Range("D20").Select
End Sub



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default macro to create a worksheet for every name on a list?

Thank you! I have been using it. It does creates a second example sheet,
example sheet(2) and the debugger kicks in because of two sheets having the
same name. But it works.

Todd



"Tom Ogilvy" wrote:

Sub CreateSheets()
Dim cell As Range, rng As Range
With Worksheets("Supplier List")
Set rng = .Range(.Range("A25"), .Range("A25").End(xlDown))
End With
For Each cell In rng
Sheets("ExampleSheet").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = cell.Value
Next
End Sub

--
Regards,
Tom Ogilvy

"Todd" wrote in message
...
I am making worksheets for each name on a list and would like to have a

macro
that can do that. I created an example sheet to copy and I recorded this
macro but I don't know how to select names from a defined list and to get

it
to keep creating new sheets for each name.

Can someone help?

TIA


Todd


Sub CreateSheets()

Sheets("ExampleSheet").Select
Sheets("ExampleSheet").Copy Befo=Sheets(18)
Sheets("ExampleSheet (2)").Select
Range("C21").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Supplier List").Select
Range("A25").Select
Selection.Copy
Sheets("ExampleSheet (2)").Select
Sheets("ExampleSheet (2)").Name = "Cutler Hammer "
Range("D20").Select
End Sub




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default macro to create a worksheet for every name on a list?

"Todd" wrote in message ...
I am making worksheets for each name on a list and would like to have a macro
that can do that.


is this a partial answer?

Sub makeMore()
Dim sRptItem As String, vCell As Variant

Application.ScreenUpdating = False
If ActiveSheet.Name = "Report" Then
For Each vCell In Selection
If vCell.Value < "" And Len(vCell.Value) < 31 Then
ActiveSheet.Copy after:=ActiveSheet
ActiveSheet.Name = vCell.Value
' other stuff to be done on sheet
End If
Next vCell
Else
MsgBox "must be run from ""Report"" sheet with a range of
cells containing the names of new sheets selected"
End If
Application.ScreenUpdating = True
End Sub
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro to create a worksheet for every name on a list?

Hope you guys are still following this. The macro stops creating sheets
somewhere in the list and recreates an examplesheet. Then it stops due to a
bad name (its examplesheet (2)). I thought I could work around it but I
can't. Any ideas?

Todd.


ps thanks for all the responses.



"Eric Barber" wrote:

"Todd" wrote in message ...
I am making worksheets for each name on a list and would like to have a macro
that can do that.


is this a partial answer?

Sub makeMore()
Dim sRptItem As String, vCell As Variant

Application.ScreenUpdating = False
If ActiveSheet.Name = "Report" Then
For Each vCell In Selection
If vCell.Value < "" And Len(vCell.Value) < 31 Then
ActiveSheet.Copy after:=ActiveSheet
ActiveSheet.Name = vCell.Value
' other stuff to be done on sheet
End If
Next vCell
Else
MsgBox "must be run from ""Report"" sheet with a range of
cells containing the names of new sheets selected"
End If
Application.ScreenUpdating = True
End Sub



Reply
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
Macro to create validation list of worksheet names tomhelle Excel Discussion (Misc queries) 1 March 14th 10 08:44 PM
create list from another worksheet Benjamin Excel Discussion (Misc queries) 4 April 10th 08 05:41 PM
How do I create a worksheet using a drop down list? TodiHawk Excel Worksheet Functions 2 May 29th 07 09:41 AM
create a list base on another worksheet tikchye_oldLearner57 Excel Discussion (Misc queries) 2 May 17th 06 01:58 PM
How to create a macro that compares a list to another list Rampa New Users to Excel 1 January 13th 05 01:15 PM


All times are GMT +1. The time now is 05:40 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"