Data Split and graph problem
Hi,
Just had a thought, I placed this macro in the worksheet and ran it
from a button rather than in a module. Could this be the reason it
didn't work?
Thanks
Joseph
Nik wrote:
joecrabtree wrote:
Regarding the chart type - I then wanted to create a Line chart with
time on the x axis, and temperature on the y axis for each set of data
( Each worksheet ). This chart would then be displayed in its own
worksheet, rather then being embedded into an existing worksheet.
This does the graphs, but I think that to get a proper time-based axis
you will have to have a scatter plot rather than a line graph. I'm not
an expert on XL charts, so I may be wrong.
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
Set ws = Sheets.Add
ws.Paste Destination:=Range("a1")
With Charts.Add
.ChartType = xlXYScatter
.SetSourceData Source:=ws.Range("A1").CurrentRegion, PlotBy _
:=xlColumns
.Location Whe=xlLocationAsObject, Name:=ws.Name
End With
End If
Next
a1Cell.CurrentRegion.Copy
Set ws = Sheets.Add
ws.Paste Destination:=Range("a1")
With Charts.Add
.ChartType = xlXYScatter
.SetSourceData Source:=ws.Range("A1").CurrentRegion, PlotBy _
:=xlColumns
.Location Whe=xlLocationAsObject, Name:=ws.Name
End With
End Sub
|