PC Review


Reply
Thread Tools Rate Thread

Copy data from 1 sheet to multiple worksheets

 
 
Rob P
Guest
Posts: n/a
 
      15th Apr 2009
I have data in columns in one worksheet

each set has two columns separated by a blank column

I wish to copy both columns of each set onto a new worksheet (renamed
with Row 1 name)


A B C D E F G H more data
accross
1 XX YY ZZ
2 Y 91 A 5 D 55
3 Z 92 B 6 E 66

columns C, F, I etc are blank - separating the data

i.e.
create new worksheet labelled "XX" with columns A and B pasted in A
and B
and new worksheet "YY" with columns D and E pasted in A and B
and new worksheet "ZZ" with columns G and H pasted in A and B

looping through all the data in the sheet (over 600 sets)


any help appreciated

thanks
Rob
 
Reply With Quote
 
 
 
 
joel
Guest
Posts: n/a
 
      15th Apr 2009

Sub SplitData()

Set Oldsht = ActiveSheet
With Oldsht
LastCol = .Cells(2, Columns.Count).End(xlToLeft).Column
For Colcount = 1 To LastCol Step 3
Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count))
Label = .Cells(1, Colcount)
NewSht.Name = Label
LastRow = .Cells(Rows.Count, Colcount).End(xlUp).Row
.Range(.Cells(2, Colcount), .Cells(LastRow, Colcount + 1)).Copy _
Destination:=NewSht.Range("A1")
Next Colcount
End With
End Sub


"Rob P" wrote:

> I have data in columns in one worksheet
>
> each set has two columns separated by a blank column
>
> I wish to copy both columns of each set onto a new worksheet (renamed
> with Row 1 name)
>
>
> A B C D E F G H more data
> accross
> 1 XX YY ZZ
> 2 Y 91 A 5 D 55
> 3 Z 92 B 6 E 66
>
> columns C, F, I etc are blank - separating the data
>
> i.e.
> create new worksheet labelled "XX" with columns A and B pasted in A
> and B
> and new worksheet "YY" with columns D and E pasted in A and B
> and new worksheet "ZZ" with columns G and H pasted in A and B
>
> looping through all the data in the sheet (over 600 sets)
>
>
> any help appreciated
>
> thanks
> Rob
>

 
Reply With Quote
 
Rob P
Guest
Posts: n/a
 
      15th Apr 2009
On Apr 15, 12:54*pm, joel <j...@discussions.microsoft.com> wrote:
> Sub SplitData()
>
> Set Oldsht = ActiveSheet
> With Oldsht
> * *LastCol = .Cells(2, Columns.Count).End(xlToLeft).Column
> * *For Colcount = 1 To LastCol Step 3
> * * * Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count))
> * * * Label = .Cells(1, Colcount)
> * * * NewSht.Name = Label
> * * * LastRow = .Cells(Rows.Count, Colcount).End(xlUp).Row
> * * * .Range(.Cells(2, Colcount), .Cells(LastRow, Colcount + 1)).Copy _
> * * * * *Destination:=NewSht.Range("A1")
> * *Next Colcount
> End With
> End Sub
>
>
>
> "Rob P" wrote:
> > I have data in columns in one worksheet

>
> > each set has two columns separated by a blank column

>
> > I wish to copy both columns of each set onto a new worksheet (renamed
> > with Row 1 name)

>
> > * * *A * * B * * C * * D * * E * * F * * G * * H * * * * * more data
> > accross
> > 1 * XX * * * * * * * * *YY * * * * * * * * ZZ
> > 2 * Y * * 91 * * * * * A * * *5 * * * * * D * * *55
> > 3 * Z * * 92 * * * * * B * * * 6 * * * * * E * * *66

>
> > columns C, F, I etc are blank - separating the data

>
> > i.e.
> > create new worksheet labelled "XX" with columns A and B pasted in A
> > and B
> > and new worksheet "YY" with columns D and E pasted in A and B
> > and new worksheet "ZZ" with columns G and H pasted in A and B

>
> > looping through all the data in the sheet (over 600 sets)

>
> > any help appreciated

>
> > thanks
> > Rob- Hide quoted text -

>
> - Show quoted text -


perfect - thank you Joel

(apologies did not realise my request was posted on two separate
sites?!?!)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transferring data from multiple worksheets to a Summary sheet Bette Microsoft Excel Misc 2 9th Mar 2009 09:53 PM
Create copy of multiple worksheets and automatically fill in datafrom a main sheet allen-nm Microsoft Excel Programming 1 23rd Feb 2008 04:24 AM
Insert formula in multiple worksheets & copy output to new sheet =?Utf-8?B?UG1hbg==?= Microsoft Excel Programming 0 2nd Oct 2007 03:17 PM
Copy data from multiple worksheets to worksheets in a number of other spreadsheets SteveH Microsoft Excel Discussion 5 6th Nov 2006 06:59 PM
Creating a summary sheet from data across multiple worksheets Mookarts Microsoft Excel Misc 1 17th Jul 2006 11:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:03 AM.