ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   object variable are not set error (https://www.excelbanter.com/excel-programming/392327-object-variable-not-set-error.html)

Daniel

object variable are not set error
 
I have this error
"object variable are not set"

and when I hit debug it highlight as below


"ActiveChart.SeriesCollection(1).Interior.ColorInd ex = 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



Peter T

object variable are not set error
 
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


"Daniel" wrote in message
...
I have this error
"object variable are not set"

and when I hit debug it highlight as below


"ActiveChart.SeriesCollection(1).Interior.ColorInd ex = 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






All times are GMT +1. The time now is 01:24 PM.

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