Skip to main content

Interior.Gradient property

Returns or sets the Gradient property of an Interior object of a selection. Read-only.

Syntax

expression.Gradient

expression A variable that represents an Interior object.

Return value

Object

Remarks

Uses either LinearGradient or RectangularGradient.

Examples

Examples

The following example sets the gradient for Range A2.

With Range("A2").Interior
    .Pattern = xlPatternLinearGradient
    .Gradient.Degree = 90
    .Gradient.ColorStops.Clear
    With .Gradient.ColorStops.Add(0)
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = 0
    End With
    With .Gradient.ColorStops.Add(1)
        .ThemeColor = xlThemeColorAccent1
        .TintAndShade = 0
    End With
End With

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>