Excel VBA, Apply Fill Pattern to Range

Jump To:


Apply Fill Pattern to Range:

The following line of code applies the reverse diagonal stripe fill pattern to the range “B5:G5”:

Range("B5:G5").Interior.Pattern = xlDown

The line below has the same result as the line above:

Range(Cells(5, 2), Cells(5, 7)).Interior.Pattern = xlDown

Before:

Excel VBA, Range, FIll Pattern, Before

After:

Excel VBA, Range, FIll Pattern, After


Modify Range’s Fill Pattern Color:

The line below changes the color of the fill pattern for the range C5:E5 to green:

Range("C5:E5").Interior.PatternColor = ColorConstants.vbGreen

The line below has the same result as the line above:

Range(Cells(5, 3), Cells(5, 5)).Interior.PatternColor = ColorConstants.vbGreen

Before:

Excel VBA, Range, FIll Pattern, After
After:

Excel VBA, Range, FIll Pattern Color, After
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 *