Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Copying columns to new sheets

I hope you can help as Im 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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Copying columns to new sheets

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 Im 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
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
Matching Columns in work sheets and copying both rows to new Shelley68 Excel Discussion (Misc queries) 1 March 19th 10 07:09 PM
copying sheets KevinB Excel Programming 3 May 30th 07 06:37 PM
Copying columns from multiple sheets in a single sheet based on a column value. [email protected] Excel Programming 1 March 21st 07 08:05 AM
Copying sheets Greg H. Excel Programming 6 January 19th 04 06:57 PM
Copying Sheets ianripping[_21_] Excel Programming 2 January 16th 04 12:28 PM


All times are GMT +1. The time now is 11:46 PM.

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

About Us

"It's about Microsoft Excel"