Share via

How to split the color background, of a split cell with diagonal border?

Anonymous
2011-09-28T18:05:36+00:00

Need to split the color background, of a split cell on a diagonal. Using the diagonal border, would like each section a different color background. Any ideas?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2015-02-10T14:15:33+00:00
    60+ people found this answer helpful.
    0 comments No comments

Answer accepted by question author

  1. Jim G 134K Reputation points MVP Volunteer Moderator
    2011-09-29T16:18:22+00:00

    As Bob mentioned, the color property of a cell affects the entire cell.  If you are trying to represent data using different colors, give SparkLines a try.

    http://mac2.microsoft.com/help/office/14/en-us/excel/item/2b084065-5e42-478c-9780-485c0a2a1c4a

    More examples and step-by-steps can be found in this reference book:

    http://www.amazon.com/dp/0470903716?tag=jigoshopa-20&camp=213381&creative=390973&linkCode=as4&creativeASIN=0470903716&adid=1Y376ZY4CS7NGMA610EC&

    1 person found this answer helpful.
    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-06-13T15:03:05+00:00

    As mentioned by Joel E you can do this fill effects but that puts a gradient where the 1st color gradually becomes a different color. If you want to remove the blending you can use VBA. I was able to quickly accomplish this by recording a macro that sets the format of a cell using fill effects. you should get code that looks like this.

    Sub Macro1()

    '

    ' Macro1 Macro

    '

        With Selection.Interior

            .Pattern = xlPatternLinearGradient

            .Gradient.Degree = 90

            .Gradient.ColorStops.Clear

        End With

        With Selection.Interior.Gradient.ColorStops.Add(0)

            .ThemeColor = xlThemeColorDark1

            .TintAndShade = 0

        End With

        With Selection.Interior.Gradient.ColorStops.Add(1)

            .ThemeColor = xlThemeColorAccent1

            .TintAndShade = 0

        End With

    End Sub

    If you want to get rid of the blending add 2 ColorStops to the code like this. Note how the color now switches between 49% and 51% of the cell. I also removed the .TintAndShade lines as they are not important.

    Sub Macro1()

    '

    ' Macro1 Macro

    '

        With Selection.Interior

            .Pattern = xlPatternLinearGradient

            .Gradient.Degree = 90

            .Gradient.ColorStops.Clear

        End With

        With Selection.Interior.Gradient.ColorStops.Add(0)

            .ThemeColor = xlThemeColorDark1 'First Color

        End With

        With Selection.Interior.Gradient.ColorStops.Add(0.49)

            .ThemeColor = xlThemeColorDark1 'First Color

        End With

        With Selection.Interior.Gradient.ColorStops.Add(0.51)

            .ThemeColor = xlThemeColorAccent1 'Second Color

        End With

        With Selection.Interior.Gradient.ColorStops.Add(1)

            .ThemeColor = xlThemeColorAccent1 'Second Color

        End With

    End Sub

    A couple of final notes.

    1. If you are looking for a diagonal or vertical color separation simply change the .Gradient.Degree to the appropriate angle.
      1. 0 = Vertical
      2. 45= rising diagonal
      3. 135 = falling diagonal
    2. Try .Color instead of .ThemeColor with a line of code like this
      1. .Color = RGB(255, 206, 0)
      2. This makes it easy to get whatever color you want all you need are the RGB integer values. Look them up on line or using excel under the More Colors> Custom colors section.
    10+ people found this answer helpful.
    0 comments No comments
  2. Jim G 134K Reputation points MVP Volunteer Moderator
    2015-02-10T16:50:15+00:00

    @ Joel - That's one heck of a link! I make it so you can can click it.

    Click here!

    Thanks for replying with this information. I hope you return again to the forum with more goodies!

    3 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2011-09-28T20:13:59+00:00

    I don't think you can do that directly. The only way I can think of is to format 2 triangle shapes to fit in the cell.

    3 people found this answer helpful.
    0 comments No comments