Range method is failing

L

Lucas Soler

For some reason, the macro only fails every other time that it's run. The
message I receive is: Method 'Range' of object '_Global' failed

Debuger brings me to this line:
Set CSPI = Range("K" & RowDataStart & ":K" & Counter)

RowDataStart and Counter are Integer types.

Any ideas?
 
J

Jan De Messemaeker

Hi,

If you have a reference to both Ecxcel and Project objects you better
explicitly cod eto which application the range method refers.
HTH
 
R

Rod Gill

Check that counter is>= RowDataStart. If it isn't then you have an illegal
address.
 
L

Lucas Soler

I made some object changes, and not it fails every other time on the last
line of the below paragraph. I've validated that RowDataStart is < Counter.

With co1.Chart
.HasTitle = True
.ChartTitle.Characters.Text = GraphTitle
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = " "
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Index"
.SeriesCollection(1).XValues = "=EV Data!R" & RowDataStart & "C1:R"
& Counter & "C1"
End With
 

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