ColorStops Object (Excel)

A collection of all the ColorStop objects for the specified series.

Version Added: Excel 2007

Each ColorStop Object represents a color stop for gradient fill in a range or selection.

The following example shows the ColorStops with LinearGradients.

With Selection.Interior 
 .Pattern = xlPatternLinearGradient 
 .Gradient.Degree = 90 
 .Gradient.ColorStops.Clear 
End With 
 
 'adds stops after any have been cleared 
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

The following example shows the ColorStops with RectangularGradients.

With Selection.Interior 
 .Pattern = xlPatternRectangularGradient 
 .Gradient.RectangleLeft = 0 
 .Gradient.RectangleRight = 0 
 .Gradient.RectangleTop = 0 
 .Gradient.RectangleBottom = 0 
 .Gradient.ColorStops.Clear 
End With 
 
With Selection.Interior.Gradient.ColorStops.Add(0) 
 .Color = 192 
 .TintAndShade = 0 
End With 
 
With Selection.Interior.Gradient.ColorStops.Add(1) 
 .ThemeColor = xlThemeColorLight1 
 .TintAndShade = 0 
End With
Show:
© 2015 Microsoft