PC Review


Reply
Thread Tools Rate Thread

Copying columns to new sheets

 
 
=?Utf-8?B?Q2hyaXM=?=
Guest
Posts: n/a
 
      2nd Jul 2007
I hope you can help as I’m new to this programming lark!

I have a spreadsheet with data in Rows A to DI. What I would like to do is
copy the data from each row into a separate new sheet and rename the sheet
with the value in the second row. I think this should work on a loop but I
am not sure how. Thanks in advance.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      2nd Jul 2007
I think you menat Columns A to DI. This code will copy the columns to column
A on each new worksheet. change "A:A" to a different column as required.


Sub newsheet()

LastColumn = Cells(2, Columns.Count).End(xlToLeft).Column
oldsheetname = ActiveSheet.Name
Set sheetnames = Sheets(oldsheetname). _
Range(Cells(2, "A"), Cells(2, LastColumn))

For Each cell In sheetnames
If cell <> oldsheetname Then

Worksheets.Add
ActiveSheet.Name = cell
cell.EntireColumn.Copy Destination:=ActiveSheet.Columns("A:A")
End If

Next cell

End Sub

"Chris" wrote:

> I hope you can help as I’m new to this programming lark!
>
> I have a spreadsheet with data in Rows A to DI. What I would like to do is
> copy the data from each row into a separate new sheet and rename the sheet
> with the value in the second row. I think this should work on a loop but I
> am not sure how. Thanks in advance.
>

 
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
Matching Columns in work sheets and copying both rows to new Shelley68 Microsoft Excel Misc 1 19th Mar 2010 07:09 PM
Retrieving Current Row,Columns & copying Format from Row,Columns a Chris Maddogz Microsoft Excel Programming 2 28th May 2009 07:36 AM
Copying sheets without copying named ranges NMACK08 Microsoft Excel Programming 1 5th Feb 2008 08:53 PM
Concatenating and Copying columns from 30 sheets Zak Microsoft Excel Programming 13 1st Feb 2008 12:12 PM
Copying columns from multiple sheets in a single sheet based on a column value. deuxstatic@gmail.com Microsoft Excel Programming 1 21st Mar 2007 08:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:47 AM.