ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   having trouble with a chart range (https://www.excelbanter.com/excel-programming/405921-having-trouble-chart-range.html)

[email protected]

having trouble with a chart range
 
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

[email protected]

having trouble with a chart range
 
got it. thanks.


All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com