vba change gradient color in graph
Results 1 to 3 of 3

Thread: vba change gradient color in graph
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jun 2019
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default vba change gradient color in graph

    Dear Excell Expert,
    Im try to change my graph with gradient color using VBA. i do record VBA when changing color to gradient but i receive error notification as follows.

    object doesn't support my property or method


    i hereby send my VBA code .

    Sub gradient()

    '
    ' gradient Macro
    '

    '


    ActiveSheet.ChartObjects("Chart 2").Activate
    ActiveChart.FullSeriesCollection(1).Select
    ActiveChart.FullSeriesCollection(1).Points(1).Select
    Selection.Format.ShapeStyle = msoShapeStylePreset75
    ActiveChart.FullSeriesCollection(1).Points(2).Select
    Selection.Format.ShapeStyle = msoShapeStylePreset77

    ActiveChart.FullSeriesCollection(1).Points(3).Select
    Selection.Format.ShapeStyle = msoShapeStylePreset74
    End Sub



    Please need your advice.

  2. #2
    Board Regular Worf's Avatar
    Join Date
    Oct 2011
    Location
    Rio, Brazil
    Posts
    3,674
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    2 Thread(s)

    Default Re: vba change gradient color in graph

    My Excel version does not recognize the constants in your code. What version are you using? Windows or Mac?
    Can you describe the steps you are taking to apply the gradient manually?
    Excel 2013 / Windows 8.1 (home)
    Excel 2013 / windows 7 (work)


  3. #3
    New Member
    Join Date
    Jun 2019
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: vba change gradient color in graph

    i use Windows OS and Excel 2016. Good News i have already succeed to fill gradient color in my chart as follows.

    Dim cht As Chart


    Set cht = ActiveSheet.ChartObjects("Chart 2").Chart

    'Change first bar chart series fill color using RGB "BLUE"
    'Change Top Color
    cht.SeriesCollection(1).Format.Fill.ForeColor.RGB = RGB(91, 155, 213)
    'Change Bottom Color
    cht.SeriesCollection(1).Format.Fill.BackColor.RGB = RGB(42, 75, 134)

    'Determine the Type of Gradient for ex: Horizontal, vertical or corner
    cht.SeriesCollection(1).Format.Fill.TwoColorGradient msoGradientHorizontal, 1
    cht.SeriesCollection(1).Format.Fill.GradientStops(1).Position = 0
    cht.SeriesCollection(1).Format.Fill.GradientStops(2).Position = 1
    Change mid Color
    cht.SeriesCollection(1).Format.Fill.GradientStops.Insert RGB(74, 118, 198), 0.5

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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