I have been stuck on this problem for far too long and no one is able to help me.
I have a large vba code already running and I have working graphs that run as well. BUT what I need to account for is that the data that is in column "G" will next time be in another column.
Here is my graphing code right now and the bold data is what I believe needs to be changed:
Code
Sub LVDT_Graph()
'
' LVDT Graph
'
'
LR = Range("A" & Rows.Count).End(xlUp).Row
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
[B] ActiveChart.SetSourceData Source:=Sheets("Data").Range( _
"Data!$B$3:$B$" & LR & ",Data!$AE$3:$AH$" & LR), PlotBy:= _
xlColumns[/B]
ActiveChart.Location Where:=xlLocationAsNewSheet, name:= _
"LVTD"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "LVDT"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, _
xlPrimary).AxisTitle.Characters.Text = "Time [s]"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, _
xlPrimary).AxisTitle.Characters.Text = "LVDT [mm]"
End With
ActiveChart.Axes(xlValue).MajorGridlines.Select
With ActiveChart.Axes(xlValue)
.MinimumScaleIsAuto = True
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLogarithmic
.DisplayUnit = xlNone
End With
ActiveChart.Axes(xlValue).MajorGridlines.Select
With ActiveChart.Axes(xlValue)
.MinimumScaleIsAuto = True
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
' Plots and formats the chart
End Sub
Display More
As you can see, for this graph, multiple columns of data are graphed.
The names of the headers will always be the same, I just need excel to find those names and graph all the data below them.
Any help would be awesome!
THANKS!