+ Reply to Thread
Results 1 to 5 of 5

Declaring ActiveChart Object

  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    Austin, TX
    MS-Off Ver
    Excel 2007
    Posts
    84

    Talking Declaring ActiveChart Object

    Thanks for reading this, I'm still kinda of new to VBA. I'm trying to figure out how I should define ActiveChart in way similar to how I defined wk6.

    I tried
    Please Login or Register  to view this content.
    Below is the code as of now with active chart highlighted in bold.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Declaring ActiveChart Object

    Hello,

    the chart is active because the code just created it.

    What is the question?

  3. #3
    Registered User
    Join Date
    01-17-2013
    Location
    Austin, TX
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Declaring ActiveChart Object

    Well, that is a good question ironically.

    I believe my question is, "What is the parent of ActiveChart?". Do you know what it is?

    I'm thinking Activeworkbook.activesheet("Sheet 1").activechart

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Declaring ActiveChart Object

    The active chart is a chart object. The parent of a chart object is the chart object collection. The parent of that is the sheet.

    If you want to create a new chart:

    Please Login or Register  to view this content.
    If you want to manipulate an existing chart

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Declaring ActiveChart Object

    To avoid names you can select and/or set charts with a value based on creation.
    1 if it is the first and only chart on the sheet. If you are manipulating the 3rd chart then put 3...
    ws.ChartObjects(1) instead of ws.ChartObjects("Chart 3") helps to know when creating loops on charts - not sure you really need it in this case but something to note -

    Cheers
    -If you think you are done, Start over - ELeGault

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Declaring variable for object..
    By calvinle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-21-2014, 12:08 AM
  2. [SOLVED] Declaring Object References at Module Level
    By RGrunden in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2012, 01:47 AM
  3. Declaring chart object problem
    By Alexander_Golinsky in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-18-2012, 01:05 PM
  4. [SOLVED] Opening Access without declaring a Global Object?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2006, 01:00 AM
  5. [SOLVED] Declaring a Rumba session as an Object
    By Matt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-02-2006, 03:10 PM

Tags for this Thread

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