View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
RyanH RyanH is offline
external usenet poster
 
Posts: 586
Default Dim cht as Object Constant Declaration

Your current code is using cht as a property of the "Chart 5". If you are
just wanting the Chart Property returned use this below.

Dim cht As Chart

cht = Sheets("Cheet4").ChartObjects("Chart 5").Chart

If you want cht as a Chart Object then use this:

Dim cht As ChartObject

Set cht = Sheets("Cheet4").ChartObjects("Chart 5")

Ryan



"R Tanner" wrote:

I have the simplest question ever. Why can I not declare this
variable? I think if you can give me a good answer you will solve my
confusion on declaring constants..

Dim cht As Object

cht = Sheets("Cheet4").ChartObjects("Chart 5").Chart


Thanks and sorry I post so many questions...