Excel VBA, Row Gradient Color

In the article Excel VBA, Gradient’s Colors I’ve explained the basics about working with gradient’s color. I’m assuming the reader is familiar with the topics covered in that article.

Gradient Color, Row:

In the article Excel VBA, Gradient’s Colors I provided 2 examples for creating gradients with different colors. The examples created a gradient with multiple colors for cell A1. In this example I will apply the gradient used in example 2 in that article to row 3:

Sub Example2()
Dim objColorStop As ColorStop

Rows(3).Interior.Pattern = xlPatternLinearGradient
'changes its orientation
Rows(3).Interior.Gradient.Degree = 90
'clears the previous colostop objects

Set objColorStop = Rows(3).Interior.Gradient.ColorStops.Add(0)
objColorStop.Color = vbYellow

Set objColorStop = Rows(3).Interior.Gradient.ColorStops.Add(0.33)
objColorStop.Color = vbRed

Set objColorStop = Rows(3).Interior.Gradient.ColorStops.Add(0.66)
objColorStop.Color = vbGreen

Set objColorStop = Rows(3).Interior.Gradient.ColorStops.Add(1)
objColorStop.Color = vbBlue
End Sub


Excel VBA, Gradient, Color, Row

Note: Intellisense may cease to display after .gradient.

See also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website  www.software-solutions-online.com

Leave a Reply

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