+ Reply to Thread
Results 1 to 4 of 4

how to set a variable to a Chart? not ChartObject

  1. #1
    Rich
    Guest

    how to set a variable to a Chart? not ChartObject

    Sheet1 contains "Chart 1"

    I want to set a variable to "Chart 1"

    Dim chrt As Chart
    Set chrt = Sheets("Sheet1").ChartObjects("Chart 1")

    This gives a type mismatch error. If I Dim chrt As ChartObject then I do
    not get the chart methods/properties in the dropdown. But I don't see any
    other options for setting chrt to "Chart 1". Any suggestions appreciated.

    Thanks,
    Rich

  2. #2
    Rob Bovey
    Guest

    Re: how to set a variable to a Chart? not ChartObject

    "Rich" <[email protected]> wrote in message
    news:[email protected]...
    > I want to set a variable to "Chart 1"
    >
    > Dim chrt As Chart
    > Set chrt = Sheets("Sheet1").ChartObjects("Chart 1")
    >
    > This gives a type mismatch error. If I Dim chrt As ChartObject then I do
    > not get the chart methods/properties in the dropdown. But I don't see any
    > other options for setting chrt to "Chart 1". Any suggestions appreciated.


    Hi Rich,

    This is how to get at the underlying Chart contained in a ChartObject:

    Set chrt = Sheets("Sheet1").ChartObjects("Chart 1").Chart

    --
    Rob Bovey, Excel MVP
    Application Professionals
    http://www.appspro.com/

    * Take your Excel development skills to the next level.
    * Professional Excel Development
    http://www.appspro.com/Books/Books.htm



  3. #3
    Tom Ogilvy
    Guest

    Re: how to set a variable to a Chart? not ChartObject

    Dim chrt As Chart
    Set chrt = Sheets("Sheet1").ChartObjects("Chart 1").Chart

    --
    Regards,
    Tom Ogilvy


    "Rich" <[email protected]> wrote in message
    news:[email protected]...
    > Sheet1 contains "Chart 1"
    >
    > I want to set a variable to "Chart 1"
    >
    > Dim chrt As Chart
    > Set chrt = Sheets("Sheet1").ChartObjects("Chart 1")
    >
    > This gives a type mismatch error. If I Dim chrt As ChartObject then I do
    > not get the chart methods/properties in the dropdown. But I don't see any
    > other options for setting chrt to "Chart 1". Any suggestions appreciated.
    >
    > Thanks,
    > Rich




  4. #4
    Rich
    Guest

    RE: how to set a variable to a Chart? not ChartObject

    Thanks all for your replies. Really appreciate it.

    Rich

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1