object variable are not set error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have this error
"object variable are not set"

and when I hit debug it highlight as below


"ActiveChart.SeriesCollection(1).Interior.ColorIndex = 0"

I have to put this at the begining to make sure no color first
What I have to do? Any comment on this
Thnks
Daniel
 
Hi Daniel,

Probably because you have not selected a chart. Try something like this -

Dim cht As Chart

Set cht = ActiveChart
If cht Is Nothing Then
MsgBox "Select a chart"
Exit Sub
End If
cht.SeriesCollection(1).Interior.ColorIndex = xlNone ' transparent fill

Of course you could set the cht reference to any chart you want without
selecting it.

Regards,
Peter T
 

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

Back
Top