Class LinearGradient (Excel VBA)

The LinearGradient object transitions through a series of colors in a linear manner along a specific angle.


To use a LinearGradient class variable it first needs to be instantiated, for example

Dim lgt as LinearGradient
Set lgt = ActiveCell.Interior.Gradient

LinearGradient class variables can be set using the Interior.Gradient procedure.


Returns the ColorStops object for the LinearGradient object.

Dim cssColorStops As ColorStops
Set cssColorStops = ActiveCell.Interior.Gradient.ColorStops


The angle of the linear gradient fill within a selection.

Uses values ranging from 0–360.

ActiveCell.Interior.Gradient.Degree = 45