View Single Post
  #6   Report Post  
Jon Peltier
 
Posts: n/a
Default

Jon -

You found something that works. This command in your earlier post must
have been causing major problems:

.Chart.Range("A2", "A" & .Range("A2", "A65534").SpecialCells _
(xlCellTypeBlanks).Cells(1).Row - 1).Name = "data"

Since a Chart has no Range method or property, the line can only lead to
run time errors.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Jon wrote:

Markus,
Thanks for the quick response. I see exactly what you are trying, but I
cannot get my code to run with it. Here's the relevant snippet, tell me if
this is what you had in mind.

Set ch = Worksheets("Charts").ChartObjects.Add(Left:=15, Width:=700, _
Top:=(J * (225 + 25) + 50), Height:=225)
With ch
.Chart.SetSourceData Source:=Sheets(xlSheet(I).Name).Range(xlSheet(I). _
Cells(2, 6), xlSheet(I).Cells(z, 8))
.Chart.Range("A2", "A" & .Range("A2", "A65534").SpecialCells _
(xlCellTypeBlanks).Cells(1).Row - 1).Name = "data"
End With

I end up with a run-time error 438 "Object doesn't support this property or
method"

What am I missing here?

"Markus Scheible" wrote:


Hi Jon,

I would try another procedu Link the chart with a named
range, e.g.

..Chart.SetSourceData Source:=Sheets("NameGoesHere").Range
("arguments")

Then you can name the arguments range, starting at a known
cell e.g. A2 and down all filled rows with:

..Range("A2", "A" & .Range("A2", "A65534").SpecialCells
(xlCellTypeBlanks).Cells(1).Row - 1).Name = "data"

For info: xlCellTypeBlanks gives you the first empty cell,
therefore you need to use .Row - 1


Best

Markus