View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nik[_3_] Nik[_3_] is offline
external usenet poster
 
Posts: 12
Default Data Split and graph problem

joecrabtree wrote:

What I want to do is split the data if there is a difference between
two adjacent times of greater than 10 minutes. So for example where I
have put a line break in the data - this is where it would be split. I
then want each 'split' set of data to be put in a new worksheet, and a
chart created for each set of data. The number of splits can vary for
each set of data.


The following will split the data as you've described.

Where do you wan t the charts to go, and what sort of chart do you want?

I've assumed no title rows on the data.

HTH, Nik
-------------------

Sub NikTest()
Dim MyRow As Integer
Dim a1Cell As Range
Set a1Cell = Sheet1.Range("a1")

allrows = Sheet1.UsedRange.Rows.Count
For MyRow = allrows - 1 To 1 Step -1
'Working upwards - always seems a good idea when inserting rows.

If a1Cell.Offset(MyRow, 0) - a1Cell.Offset(MyRow - 1, 0) (1 /
144) Then
'We have a 10 minute gap between myrow and the row above it.

a1Cell.Offset(MyRow, 0).EntireRow.Insert
a1Cell.Offset(MyRow + 1, 0).CurrentRegion.Copy
'End With

With sheets.Add

.Paste Destination:=Range("a1")


End With

End If
Next

a1Cell.CurrentRegion.Copy

With sheets.Add
.Paste Destination:=Range("a1")
End With
End Sub