Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I know the hot topic is merging multiple sheets into one... I'm trying to
unmerge data. I have spreadsheets that repeat data. So basically I have a date, the next row contains all the headers. Then the data... A space then another date headers and its data, so on and so on... The data can vary, for example a sheet will have data like this 03/01/06 - A1, Headers A2, Data A3: AA45, 03/02/06 - A47, headers A48, Data A49: AA59 The two things that are constant the headers length, they will always go from A3:AA45 and there is always one space between the end of the data and the beginning of the next set. I would like to create a macro that grabs the date and all its data to the next space and places it in its own sheet and continue doing it until no more data is left in the original sheet... So I would end up with 47 sheets for example. Please help. Thanks Ramon |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Assume all the dates are unique:
Sub DisperseData() Dim rng as Range, ar as Range Dim sh as Worksheet with worksheets("Master") set rng = columns(1).specialcells(xlconstants) End with for each ar in rng.Areas set sh = worksheets.Add After:=worksheets(worksheets.count) sh.name = ar(1).Text ar.entirerow.copy Destination:=sh.Range("A1") Next End Sub -- Regards, Tom Ogilvy "THE_RAMONES" wrote: I know the hot topic is merging multiple sheets into one... I'm trying to unmerge data. I have spreadsheets that repeat data. So basically I have a date, the next row contains all the headers. Then the data... A space then another date headers and its data, so on and so on... The data can vary, for example a sheet will have data like this 03/01/06 - A1, Headers A2, Data A3: AA45, 03/02/06 - A47, headers A48, Data A49: AA59 The two things that are constant the headers length, they will always go from A3:AA45 and there is always one space between the end of the data and the beginning of the next set. I would like to create a macro that grabs the date and all its data to the next space and places it in its own sheet and continue doing it until no more data is left in the original sheet... So I would end up with 47 sheets for example. Please help. Thanks Ramon |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom
I get a syntax error on set sh = Worksheets.Add After:=Worksheets(Worksheets.count) Any thoughts... Thanks again for the help "Tom Ogilvy" wrote: Assume all the dates are unique: Sub DisperseData() Dim rng as Range, ar as Range Dim sh as Worksheet with worksheets("Master") set rng = columns(1).specialcells(xlconstants) End with for each ar in rng.Areas set sh = worksheets.Add After:=worksheets(worksheets.count) sh.name = ar(1).Text ar.entirerow.copy Destination:=sh.Range("A1") Next End Sub -- Regards, Tom Ogilvy "THE_RAMONES" wrote: I know the hot topic is merging multiple sheets into one... I'm trying to unmerge data. I have spreadsheets that repeat data. So basically I have a date, the next row contains all the headers. Then the data... A space then another date headers and its data, so on and so on... The data can vary, for example a sheet will have data like this 03/01/06 - A1, Headers A2, Data A3: AA45, 03/02/06 - A47, headers A48, Data A49: AA59 The two things that are constant the headers length, they will always go from A3:AA45 and there is always one space between the end of the data and the beginning of the next set. I would like to create a macro that grabs the date and all its data to the next space and places it in its own sheet and continue doing it until no more data is left in the original sheet... So I would end up with 47 sheets for example. Please help. Thanks Ramon |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
a last minute change. Apparently incomplete. should be
set sh = Worksheets.Add( After:=Worksheets(Worksheets.count)) -- Regards, Tom Ogilvy "THE_RAMONES" wrote: Tom I get a syntax error on set sh = Worksheets.Add After:=Worksheets(Worksheets.count) Any thoughts... Thanks again for the help "Tom Ogilvy" wrote: Assume all the dates are unique: Sub DisperseData() Dim rng as Range, ar as Range Dim sh as Worksheet with worksheets("Master") set rng = columns(1).specialcells(xlconstants) End with for each ar in rng.Areas set sh = worksheets.Add After:=worksheets(worksheets.count) sh.name = ar(1).Text ar.entirerow.copy Destination:=sh.Range("A1") Next End Sub -- Regards, Tom Ogilvy "THE_RAMONES" wrote: I know the hot topic is merging multiple sheets into one... I'm trying to unmerge data. I have spreadsheets that repeat data. So basically I have a date, the next row contains all the headers. Then the data... A space then another date headers and its data, so on and so on... The data can vary, for example a sheet will have data like this 03/01/06 - A1, Headers A2, Data A3: AA45, 03/02/06 - A47, headers A48, Data A49: AA59 The two things that are constant the headers length, they will always go from A3:AA45 and there is always one space between the end of the data and the beginning of the next set. I would like to create a macro that grabs the date and all its data to the next space and places it in its own sheet and continue doing it until no more data is left in the original sheet... So I would end up with 47 sheets for example. Please help. Thanks Ramon |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom
We are almost there... I'm getting an Error "Application-defined" or object defined error.... Here is what I have so far.. Sub DisperseData() Dim rng As Range, ar As Range Dim sh As Worksheet With Worksheets("Master") Set rng = Columns(1).SpecialCells(xlConstants) End With For Each ar In rng.Areas Set sh = Worksheets.Add(After:=Worksheets(Worksheets.Count) ) sh.Name = ar(1).Text ar.EntireRow.Copy Destination:=sh.Range("A1") Next End Sub Thanks Again.. "Tom Ogilvy" wrote: a last minute change. Apparently incomplete. should be set sh = Worksheets.Add( After:=Worksheets(Worksheets.count)) -- Regards, Tom Ogilvy "THE_RAMONES" wrote: Tom I get a syntax error on set sh = Worksheets.Add After:=Worksheets(Worksheets.count) Any thoughts... Thanks again for the help "Tom Ogilvy" wrote: Assume all the dates are unique: Sub DisperseData() Dim rng as Range, ar as Range Dim sh as Worksheet with worksheets("Master") set rng = columns(1).specialcells(xlconstants) End with for each ar in rng.Areas set sh = worksheets.Add After:=worksheets(worksheets.count) sh.name = ar(1).Text ar.entirerow.copy Destination:=sh.Range("A1") Next End Sub -- Regards, Tom Ogilvy "THE_RAMONES" wrote: I know the hot topic is merging multiple sheets into one... I'm trying to unmerge data. I have spreadsheets that repeat data. So basically I have a date, the next row contains all the headers. Then the data... A space then another date headers and its data, so on and so on... The data can vary, for example a sheet will have data like this 03/01/06 - A1, Headers A2, Data A3: AA45, 03/02/06 - A47, headers A48, Data A49: AA59 The two things that are constant the headers length, they will always go from A3:AA45 and there is always one space between the end of the data and the beginning of the next set. I would like to create a macro that grabs the date and all its data to the next space and places it in its own sheet and continue doing it until no more data is left in the original sheet... So I would end up with 47 sheets for example. Please help. Thanks Ramon |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I found the error it was looking for text field in ar(1), I change that to,
ar(2), fixed the first group of numbers but still having problems grabbing the second and third set. I'm still working on it. I'll let you know when I get some where. If you think something let me know. Thanks "THE_RAMONES" wrote: Tom We are almost there... I'm getting an Error "Application-defined" or object defined error.... Here is what I have so far.. Sub DisperseData() Dim rng As Range, ar As Range Dim sh As Worksheet With Worksheets("Master") Set rng = Columns(1).SpecialCells(xlConstants) End With For Each ar In rng.Areas Set sh = Worksheets.Add(After:=Worksheets(Worksheets.Count) ) sh.Name = ar(1).Text ar.EntireRow.Copy Destination:=sh.Range("A1") Next End Sub Thanks Again.. "Tom Ogilvy" wrote: a last minute change. Apparently incomplete. should be set sh = Worksheets.Add( After:=Worksheets(Worksheets.count)) -- Regards, Tom Ogilvy "THE_RAMONES" wrote: Tom I get a syntax error on set sh = Worksheets.Add After:=Worksheets(Worksheets.count) Any thoughts... Thanks again for the help "Tom Ogilvy" wrote: Assume all the dates are unique: Sub DisperseData() Dim rng as Range, ar as Range Dim sh as Worksheet with worksheets("Master") set rng = columns(1).specialcells(xlconstants) End with for each ar in rng.Areas set sh = worksheets.Add After:=worksheets(worksheets.count) sh.name = ar(1).Text ar.entirerow.copy Destination:=sh.Range("A1") Next End Sub -- Regards, Tom Ogilvy "THE_RAMONES" wrote: I know the hot topic is merging multiple sheets into one... I'm trying to unmerge data. I have spreadsheets that repeat data. So basically I have a date, the next row contains all the headers. Then the data... A space then another date headers and its data, so on and so on... The data can vary, for example a sheet will have data like this 03/01/06 - A1, Headers A2, Data A3: AA45, 03/02/06 - A47, headers A48, Data A49: AA59 The two things that are constant the headers length, they will always go from A3:AA45 and there is always one space between the end of the data and the beginning of the next set. I would like to create a macro that grabs the date and all its data to the next space and places it in its own sheet and continue doing it until no more data is left in the original sheet... So I would end up with 47 sheets for example. Please help. Thanks Ramon |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Got it.... It was naming of sheets that needed to be commented. Out . I
apprecate help... It worked great... Code I used is below Sub DisperseData() Dim rng As Range, ar As Range Dim sh As Worksheet With Worksheets("Master") Set rng = Columns(1).SpecialCells(xlConstants) End With For Each ar In rng.Areas Set sh = Worksheets.Add(After:=Worksheets(Worksheets.Count) ) 'sh.Name = ar(1).Number ar.EntireRow.Copy Destination:=sh.Range("A1") Next End Sub "THE_RAMONES" wrote: Tom We are almost there... I'm getting an Error "Application-defined" or object defined error.... Here is what I have so far.. Sub DisperseData() Dim rng As Range, ar As Range Dim sh As Worksheet With Worksheets("Master") Set rng = Columns(1).SpecialCells(xlConstants) End With For Each ar In rng.Areas Set sh = Worksheets.Add(After:=Worksheets(Worksheets.Count) ) sh.Name = ar(1).Text ar.EntireRow.Copy Destination:=sh.Range("A1") Next End Sub Thanks Again.. "Tom Ogilvy" wrote: a last minute change. Apparently incomplete. should be set sh = Worksheets.Add( After:=Worksheets(Worksheets.count)) -- Regards, Tom Ogilvy "THE_RAMONES" wrote: Tom I get a syntax error on set sh = Worksheets.Add After:=Worksheets(Worksheets.count) Any thoughts... Thanks again for the help "Tom Ogilvy" wrote: Assume all the dates are unique: Sub DisperseData() Dim rng as Range, ar as Range Dim sh as Worksheet with worksheets("Master") set rng = columns(1).specialcells(xlconstants) End with for each ar in rng.Areas set sh = worksheets.Add After:=worksheets(worksheets.count) sh.name = ar(1).Text ar.entirerow.copy Destination:=sh.Range("A1") Next End Sub -- Regards, Tom Ogilvy "THE_RAMONES" wrote: I know the hot topic is merging multiple sheets into one... I'm trying to unmerge data. I have spreadsheets that repeat data. So basically I have a date, the next row contains all the headers. Then the data... A space then another date headers and its data, so on and so on... The data can vary, for example a sheet will have data like this 03/01/06 - A1, Headers A2, Data A3: AA45, 03/02/06 - A47, headers A48, Data A49: AA59 The two things that are constant the headers length, they will always go from A3:AA45 and there is always one space between the end of the data and the beginning of the next set. I would like to create a macro that grabs the date and all its data to the next space and places it in its own sheet and continue doing it until no more data is left in the original sheet... So I would end up with 47 sheets for example. Please help. Thanks Ramon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
create multiple sheets using info from one | Excel Discussion (Misc queries) | |||
Create and name multiple sheets | Excel Discussion (Misc queries) | |||
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA | Excel Worksheet Functions | |||
How to create workbook with multiple sheets | Excel Discussion (Misc queries) | |||
How do i auto create multiple files from 1 with multiple sheets | Excel Worksheet Functions |