Can I create a multi-color cell without a gradient in Excel?
Andrew Mclaughlin
I want to apply two colors to one cell and separate them diagonally. I know that there is a function to add gradients in Excel, but I haven't found a way to set the strength of the color stop.
32 Answers
So after playing around a little bit, I figured out how to do it. My mistake was that I only added two color stops, when I should've added 4 color stops, in order to remove the color gradient. The gradient is being automatically added to create a smooth color transition between two colors. If you make the color stop distance between two colors as small as possible, you won't see a color gradient.
Here is my code:
With Selection.Interior .Pattern = xlPatternLinearGradient .Gradient.Degree = 225 .Gradient.ColorStops.Clear
End With
With Selection.Interior.Gradient.ColorStops.Add(0) .Color = RGB(255, 0, 0) .TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(0.49999999) .Color = RGB(255, 0, 0) .TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(0.5) .Color = RGB(0, 255, 0) .TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(1) .Color = RGB(0, 255, 0) .TintAndShade = 0
End WithAnd here is how it looks like: Two colored Excel cell
Create an image in Photoshop or similar, resize and insert into cell.
1