TheRedCardinal
Board Regular
- Joined
- Jul 11, 2019
- Messages
- 243
- Office Version
- 365
- 2021
- Platform
- Windows
I have a variation on the below code which colours my rows different shades of blue.
My problem is some of my cells in the first column are merged, the pattern is not fixed and nor is the number of merged cells. But I want all of the subsequent columns to be the same colour as the cell in column A.
Here is a picture:
So row 1 is good.
Row A2:A4 are merged and one colour, but B2:E4 have alternate colours.
Is my request even possible?
VBA Code:
Sub StripeyPresentation()
Dim Rng As Range
Set Rng = Selection
With Rng.FormatConditions.Add(Type:=xlExpression, Formula1:="=MOD(ROW(),2)=0")
.Interior.Color = RGB(208, 216, 232)
.Borders.LineStyle = xlContinuous
.Borders.ThemeColor = 1
.Borders.Weight = xlThin
End With
With Rng.FormatConditions.Add(Type:=xlExpression, Formula1:="=MOD(ROW(),2)=1")
.Interior.Color = RGB(233, 237, 244)
.Borders.LineStyle = xlContinuous
.Borders.ThemeColor = 1
.Borders.Weight = xlThin
End With
End Sub
My problem is some of my cells in the first column are merged, the pattern is not fixed and nor is the number of merged cells. But I want all of the subsequent columns to be the same colour as the cell in column A.
Here is a picture:
So row 1 is good.
Row A2:A4 are merged and one colour, but B2:E4 have alternate colours.
Is my request even possible?