+ Reply to Thread
Results 1 to 11 of 11

Macro doesn't change fill colour only line colour

  1. #1
    Registered User
    Join Date
    04-10-2020
    Location
    Dublin, Ireland
    MS-Off Ver
    Office365
    Posts
    28

    Macro doesn't change fill colour only line colour

    Hi all,

    I have a macro set up to change the colour of the triangle in my graph/scatter plot to indicate the project task status. The colour changes based on the selection from the drop down list in S31.

    Only problem is it is only changing the Line colour, but not the Fill colour... I can't seem to figure it out especially since I took it from the macro recorder.

    See attached my example excel, but below a code snippet. I would really appreciate if someone could have a quick look.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by RuairiO; 03-24-2021 at 04:45 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro doesn't change fill colour only line colour

    The macro recorder is OK but the code it generates always needs review.

    The line that changes ForeColor works. For some reason, the next two lines reverse the effect. I do not know why setting the line to 0 transparency and solid would do that.

    Also, you don't need to active and select things to work on them. This code works correctly:

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Macro doesn't change fill colour only line colour

    Don't use a macro - use one graph line per color by splitting your data into columns - I set up the Red values for you in the attached.
    Attached Files Attached Files
    Bernie Deitrick
    Excel MVP 2000-2010

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro doesn't change fill colour only line colour

    I just answered the question but Bernie Deitrick solved the problem

  5. #5
    Registered User
    Join Date
    04-10-2020
    Location
    Dublin, Ireland
    MS-Off Ver
    Office365
    Posts
    28

    Re: Macro doesn't change fill colour only line colour

    Thank you both so much! Worked like a charm.

  6. #6
    Registered User
    Join Date
    04-10-2020
    Location
    Dublin, Ireland
    MS-Off Ver
    Office365
    Posts
    28

    Re: Macro doesn't change fill colour only line colour

    Thanks very much for showing a way to do this without a macro btw. I had actually orginally asked this in another thread, but had gotten no answer and so went the macro route. I need to check this a little deeper. Thanks a lot!

  7. #7
    Registered User
    Join Date
    04-10-2020
    Location
    Dublin, Ireland
    MS-Off Ver
    Office365
    Posts
    28

    Re: Macro doesn't change fill colour only line colour

    Thanks a lot. This really helps. I find it touch to target objects in charts with macros, but this looks pretty simkple actually so thanksa lot.

    In the end I went with this for now, unless work doesn't want macros

    Then I added the below to make it dynamic. Thanks a lot. I attached the updated sheet in case anyone finds it handy.

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 03-30-2021 at 11:28 AM. Reason: code tags

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Macro doesn't change fill colour only line colour

    Or I just hate dealing with graphs in VBA

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro doesn't change fill colour only line colour

    Quote Originally Posted by RuairiO View Post
    Thanks a lot. This really helps.


    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time. --6StringJazzer

  10. #10
    Registered User
    Join Date
    04-10-2020
    Location
    Dublin, Ireland
    MS-Off Ver
    Office365
    Posts
    28

    Re: Macro doesn't change fill colour only line colour

    Just to let you know I went back to your solution and took some time to understand it. I now just updated my graph with your table and now that I understand it I actually find this much easier than using the macros. This is really a great solution plus I learned a lot about conditional formatting of graphs Thanks so much!!!

  11. #11
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Macro doesn't change fill colour only line colour

    And you don't have to deal with graphs in VBA! (My favorite part of that LOL)

+ 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. Linking colour of line graph to colour of an unrelated cell?
    By Marisa5567 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 11-10-2020, 05:36 AM
  2. [SOLVED] Macro to use Fill Colour In Subject Line in Outlook
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2019, 01:42 PM
  3. [SOLVED] identifying shape.type to change colour of line or fill
    By demarc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2016, 08:56 AM
  4. VBA to colour data labels same as line colour - dynamic chart
    By Jabba69 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-06-2014, 10:59 AM
  5. Replies: 1
    Last Post: 09-12-2013, 02:09 PM
  6. Macro with IF statement for if a series exists change colour of line in graph
    By sim410 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2012, 06:20 AM
  7. [SOLVED] macro to hide rows if a cell in column B doesn't have a fill colour
    By petelomax in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-08-2012, 10:11 AM

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