having trouble with a chart range

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top