Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to create validation list of worksheet names | Excel Discussion (Misc queries) | |||
create list from another worksheet | Excel Discussion (Misc queries) | |||
How do I create a worksheet using a drop down list? | Excel Worksheet Functions | |||
create a list base on another worksheet | Excel Discussion (Misc queries) | |||
How to create a macro that compares a list to another list | New Users to Excel |