Hi, I'm having a problem being able to create a table that will select the minimum year and count all the rain events down to the last year... Here's my macro VBA script for the chart I have created. The problem is if I import data thats from 1893 until 2015 there will be a lot of data. However if I import data that is from 2000 to 2015 there will be a lot of 0's down the page from the previous 1893 to 2015 data. I've also included a picture to help if it is needed.
Cheers.
P.s. the table is in the bottom right of the picture
_____________________________________________VBA CODE_____________________________________________
Sub Timeseries()
'
' Timeseries Macro
'
'
ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmoothNoMarkers).Select
ActiveChart.SetSourceData Source:=Sheets("Daily Rainfall").Range("J19:K142")
ActiveChart.ChartTitle.Select
ActiveChart.ChartTitle.Text = "Time Series of Rainfall Events"
Selection.Format.TextFrame2.TextRange.Characters.Text = _
"Time Series of Rainfall Events"
With Selection.Format.TextFrame2.TextRange.Characters(1, 30).ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
With Selection.Format.TextFrame2.TextRange.Characters(1, 30).Font
.BaselineOffset = 0
.Bold = msoFalse
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(89, 89, 89)
.Fill.Transparency = 0
.Fill.Solid
.Size = 14
.Italic = msoFalse
.Kerning = 12
.Name = "+mn-lt"
.UnderlineStyle = msoNoUnderline
.Spacing = 0
.Strike = msoNoStrike
End With
ActiveChart.ChartArea.Select
End Sub
Cheers.
P.s. the table is in the bottom right of the picture
_____________________________________________VBA CODE_____________________________________________
Sub Timeseries()
'
' Timeseries Macro
'
'
ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmoothNoMarkers).Select
ActiveChart.SetSourceData Source:=Sheets("Daily Rainfall").Range("J19:K142")
ActiveChart.ChartTitle.Select
ActiveChart.ChartTitle.Text = "Time Series of Rainfall Events"
Selection.Format.TextFrame2.TextRange.Characters.Text = _
"Time Series of Rainfall Events"
With Selection.Format.TextFrame2.TextRange.Characters(1, 30).ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
With Selection.Format.TextFrame2.TextRange.Characters(1, 30).Font
.BaselineOffset = 0
.Bold = msoFalse
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(89, 89, 89)
.Fill.Transparency = 0
.Fill.Solid
.Size = 14
.Italic = msoFalse
.Kerning = 12
.Name = "+mn-lt"
.UnderlineStyle = msoNoUnderline
.Spacing = 0
.Strike = msoNoStrike
End With
ActiveChart.ChartArea.Select
End Sub
