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: 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



  #4   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

  #5   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






  #6   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



  #7   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

  #8   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
  #9   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

  #10   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





  #11   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?


re a question on calling a UDF direct from graph's dataseries
i found that it could be done via a name.

it appears to have been thought of by others, which just proved
Bob's/Harlan's point...

very little new here :-)!


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

Tom Ogilvy wrote in message
:

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


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


Hi, I have a similar enquiry...

BUt the opposite way round.

I can create the worksheets, but want the worksheet names to list i
cells on a master worksheet.

How do i do this

--
aking198
-----------------------------------------------------------------------
aking1987's Profile: http://www.excelforum.com/member.php...fo&userid=1539
View this thread: http://www.excelforum.com/showthread.php?threadid=27758

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

try this code
your list is in SHEET1 and in range D4 to D8


Option Explicit


Public Sub test()
Dim nname As String
Dim cell As Range
Worksheets("sheet1").Activate
For Each cell In Range("d4:d8")
cell.Activate
nname = ActiveCell.Value
Worksheets.Add after:=Sheet1

ActiveSheet.Name = nname
Worksheets("sheet1").Activate

Next

End Sub

aking1987 wrote in message
...

Hi, I have a similar enquiry...

BUt the opposite way round.

I can create the worksheets, but want the worksheet names to list in
cells on a master worksheet.

How do i do this?


--
aking1987
------------------------------------------------------------------------
aking1987's Profile:

http://www.excelforum.com/member.php...o&userid=15393
View this thread: http://www.excelforum.com/showthread...hreadid=277583



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


Application-defined or object-defined error


Code
-------------------
Option Explicit


Public Sub test()
Dim nname As String
Dim cell As Range
Worksheets("Master Numbers").Activate
For Each cell In Range("d4:d8")
cell.Activate
nname = ActiveCell.Value
Worksheets.Add after:=Sheet1

ActiveSheet.Name = nname

Worksheets("Master Numbers").Activate

Next

End Sub

-------------------

--
aking198
-----------------------------------------------------------------------
aking1987's Profile: http://www.excelforum.com/member.php...fo&userid=1539
View this thread: http://www.excelforum.com/showthread.php?threadid=27758

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


The list of worksheet names is continually growing...

D4:d8 only gives space for 4 names.

can it be done by column? So it can continue to grow infintly

Thank you

--
aking198
-----------------------------------------------------------------------
aking1987's Profile: http://www.excelforum.com/member.php...fo&userid=1539
View this thread: http://www.excelforum.com/showthread.php?threadid=27758



  #16   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?


try s'th like:

dim nm as name
dim n as long

With Worksheets("Master").Cells(1)
for each nm in activeworkbook.names
.offset(n).resize(,2) =
array(nm.name,nm.refersto)
n=n+1
next
end with




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


aking1987 wrote :


The list of worksheet names is continually growing...

D4:d8 only gives space for 4 names.

can it be done by column? So it can continue to grow infintly

Thank you!

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 10:23 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"