Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Copy data from 1 sheet to multiple worksheets

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Copy data from 1 sheet to multiple worksheets


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Copy data from 1 sheet to multiple worksheets

On Apr 15, 12:54*pm, joel 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
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
Create copy of multiple worksheets and automatically fill in datafrom a main sheet allen-nm Excel Programming 1 February 23rd 08 04:24 AM
Insert formula in multiple worksheets & copy output to new sheet Pman Excel Programming 0 October 2nd 07 03:17 PM
copy data across worksheets and add multiple lines madwoman Excel Programming 0 August 13th 06 01:35 PM
Copy data in multiple worksheets kfletchb New Users to Excel 2 August 11th 06 12:18 AM
Copy only certain data from multiple worksheets Matt Excel Discussion (Misc queries) 0 February 10th 06 03:06 PM


All times are GMT +1. The time now is 10:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"