+ Reply to Thread
Results 1 to 8 of 8

If legend exists then do nothing code

  1. #1
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    If legend exists then do nothing code

    Hello everyone,

    Here is my code:

    Please Login or Register  to view this content.
    I want to set legend to the right side of the chart but only IF the chart already doesn't have a legend. I've tried multiple ways of doing this. Examples like "If Legend = False then" and also been trying with "Else" . How are you suppose to write this properly?

    I also want to Plotarea size depending on which kind of graph it is.
    Please Login or Register  to view this content.

    Can you do that in the same macro? What I trying to do is to have 1 plot area size for a column graph and a different one if it's circle diagram but in the same macro. Hope this makes sense haha.
    Book1.xlsm

    Thanks in advance,
    Joachim
    Last edited by Joachimjr; 07-16-2014 at 09:33 AM.

  2. #2
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: If legend exists then do nothing code

    Anyone got a sweet solution for this?

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: If legend exists then do nothing code

    Please Login or Register  to view this content.
    is what you're looking for, I think.
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: If legend exists then do nothing code

    Thank you! Now that is solved. Now I have my other problem, which is that I want the plot area to be X size when the macro is used on a column graph and when the macro is used on a circle diagram I want the plot area to be Y size.

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: If legend exists then do nothing code

    Please Login or Register  to view this content.
    I'm not clear whether you mean a bubble chart, a pie chart or something else.

  6. #6
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: If legend exists then do nothing code

    Pie chart. The part of code that you linked there, is it suppose to replace something or be added?

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: If legend exists then do nothing code

    You would put your sizing code for a column chart into the indicated area, and the code for a pie chart would follow the Case Else line.

  8. #8
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: If legend exists then do nothing code

    Perfect! Thank you very much!

+ 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. [SOLVED] Adding a code for the legend in the chart at the bottom
    By cadcraft in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 08-29-2013, 10:35 AM
  2. [SOLVED] IF Exists or on Error Then - Skip Code- How to write code?
    By Jack7774 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2013, 06:45 PM
  3. Replies: 1
    Last Post: 01-17-2012, 06:39 AM
  4. if exists code
    By burgerboy2k6 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2007, 06:48 PM
  5. [SOLVED] If Worksheet exists...Then run code
    By PCLIVE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-17-2006, 04:35 PM

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