Class ColorStop (Excel VBA)

The class ColorStop represents the color stop point for a gradient fill in a range or selection. To use a ColorStop class variable it first needs to be instantiated, for example


Dim cstp as ColorStop
Set cstp = ActiveCell.Interior.Gradient.ColorStops(Index:=1)

For Each

Here is an example of processing the ColorStop items in a collection.


Dim cstp As ColorStop
For Each cstp In ActiveCell.Interior.Gradient.ColorStops
	
Next cstp

Color

Returns or sets the color of the represented object.


ActiveCell.Interior.Gradient.ColorStops(1).Color =

Delete

Deletes the represented object.


ActiveCell.Interior.Gradient.ColorStops(1).Delete

Position

Returns or sets the position of the ColorStop.


ActiveCell.Interior.Gradient.ColorStops(1).Position =

ThemeColor

Returns or sets the theme color of the represented object.


Range("A1:A10").Select 
With Selection.Interior.Gradient.ColorStop.Add(1) 
 .ThemeColor = xlThemeColorAccent1 
 .TintAndShade = 0 
End With

TintAndShade

Returns or sets the tint and shade of the represented object. Read/write