M
mandjdubois
I have a table that is being filtered. I want a chart to be added
using a column found using a FIND. Because table is being filtered the
last row is changes. So I am lost on how to set the range for the
chart - see ***** in code below.
This chart is being deleted and recreated after the filter changes. I
was using the UsedRange, but that gives me part of my table that has
been filtered out.
Chart data should be (Column variable, cell 1 to column variable, cell
in last row).
I appreciate the help. - Mike
'data has been filtered, now find last row
Range("A65000").End(xlUp).Select
LastDataRow = ActiveCell.Row 'got last row
'now find the first dfParm in a series - so column is unknown as of
now
Rows("1:1").Select
Selection.Find(What:=dfParm, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
CrntCol = ActiveCell.Column 'got current column #
Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets(DataSheet).*****,
PlotBy:=xlColumns
using a column found using a FIND. Because table is being filtered the
last row is changes. So I am lost on how to set the range for the
chart - see ***** in code below.
This chart is being deleted and recreated after the filter changes. I
was using the UsedRange, but that gives me part of my table that has
been filtered out.
Chart data should be (Column variable, cell 1 to column variable, cell
in last row).
I appreciate the help. - Mike
'data has been filtered, now find last row
Range("A65000").End(xlUp).Select
LastDataRow = ActiveCell.Row 'got last row
'now find the first dfParm in a series - so column is unknown as of
now
Rows("1:1").Select
Selection.Find(What:=dfParm, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
CrntCol = ActiveCell.Column 'got current column #
Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets(DataSheet).*****,
PlotBy:=xlColumns