Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Automatic creation of worksheets

Does anyone have any idea how to accomplish the following using a
macro? The first sheet has 'n' number of rows. I want to
automatically create a seaparate worksheet for each block of 25 rows.

The 2nd worksheet would contain the data from rows 1-25 of the 1st
worksheet.

The 3rd worksheet would contain the data from rows 26-30 of the 1st
worksheet.

etc. until the last row of the 1st worksheet

The name of each worksheet would be the contents of column B1, hyphen,
contents of column B25.

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default Automatic creation of worksheets

Try this macro.

Sub SplitWorksheet()

FirstSheetname = ActiveSheet.Name
Lastrow = Range(Cells(1, 1), Cells(Rows.Count, 1)).End(xlDown).Row

For i = 1 To Lastrow Step 25
NewSheetName = Sheets(FirstSheetname). _
Range("B1").Offset(rowoffset:=i - 1, columnoffset:=0) + "-"
NewSheetName = NewSheetName + Sheets(FirstSheetname).Range("B25"). _
Offset(rowoffset:=i - 1, columnoffset:=0)
Sheets.Add
ActiveSheet.Name = NewSheetName
Sheets(FirstSheetname).Rows("1:25"). _
Offset(rowoffset:=i - 1, columnoffset:=0).Copy _
Destination:=Worksheets(NewSheetName).Range("A1")

Next i


End Sub

"dave" wrote:

Does anyone have any idea how to accomplish the following using a
macro? The first sheet has 'n' number of rows. I want to
automatically create a seaparate worksheet for each block of 25 rows.

The 2nd worksheet would contain the data from rows 1-25 of the 1st
worksheet.

The 3rd worksheet would contain the data from rows 26-30 of the 1st
worksheet.

etc. until the last row of the 1st worksheet

The name of each worksheet would be the contents of column B1, hyphen,
contents of column B25.

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Automatic creation of worksheets

That is exactly what I wanted. Thank you very much.

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
Include/Exclude Holiday from Automatic Sheet Creation David Excel Discussion (Misc queries) 0 August 27th 06 04:51 PM
How do I set up automatic sequentially numbering for worksheets? ned Excel Worksheet Functions 0 December 11th 05 06:46 PM
Automatic Data Validation drop down creation Buddhapenguin Excel Discussion (Misc queries) 1 May 12th 05 08:41 PM
Automatic Number Creation Problem? Corp Excel Worksheet Functions 1 April 6th 05 06:19 AM
Automatic Calculate Worksheets Phyllis Excel Worksheet Functions 1 November 12th 04 06:07 PM


All times are GMT +1. The time now is 04:56 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"