LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Split large sheet into several smaller sheets for emailing

I need to split large datasheet (over 20,000 rows) into separate worksheets,
which will then be emailed to individuals.

My problem that the data is in 10 columns and col 1 may contain from 1 to 95
items that are identical in the first cell.

What I need is the ability to compare A2 with A3 and if the same then A4
with A3 and so on until A(x) is compared with the previous cell and at that
point create a new worksheet.
An additional nice touch would be to name the worksheet with the contents of
the cell A1 and subsequent data changes.
Example data:
A B C
1 Fred Dog Cat
2 Fred Fish Apple
3 Joe Item1 Item2
4 Joe Item1 Item3
5 Joe Item 2 Item3
In this case a new Worksheet would be created between Fred and Joe.
I have used the code below from another post that does part of this but am
stuck on the rest.

Sub Make_Reports()

Dim iReport As Integer
Dim lRow As Long
Dim wsReport As Worksheet
Dim wsData As Worksheet

'speed things up a bit
Application.ScreenUpdating = False

iReport = 1
lRow = 2 'assumes first row is header row
Set wsData = ActiveSheet

Do While wsData.Cells(lRow, 1).Formula < ""
'add new worksheet for new report
Set wsReport = Worksheets.Add
wsReport.Name = "Report " & iReport
'copy headers
wsData.Range("A1:J1").Copy _
Destination:=wsReport.Range("A1")
'copy data (25 rows * 10 columns
wsData.Cells(lRow, 1).Resize(25, 10).Copy _
Destination:=wsReport.Range("A2")

End Sub




Thanks in advance for all your help

Don


 
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
how to split a large excel file into multiple smaller exel files. RM Excel Discussion (Misc queries) 2 February 17th 10 10:13 PM
Split table into smaller tables & into different worksheets each Pradeep Excel Worksheet Functions 8 May 9th 07 05:39 PM
How to split worksheet to make smaller Ltl Doc Excel Worksheet Functions 1 April 5th 06 08:14 AM
Huge sheet into smaller sheets Mia Excel Discussion (Misc queries) 2 January 28th 05 11:36 PM
Huge sheet into smaller sheets Mia Links and Linking in Excel 1 January 28th 05 07:40 AM


All times are GMT +1. The time now is 03:55 PM.

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"