I have a sheet where in column B the cells are merged with the row below. In the rest of the columns the rows are not merged.
I want to add a VBA code that draws a line across the bottom of the entire row along the bottom of the merged cells. It's as if I wanted to draw a bottom border every other row for all columns (except B where each merged cell would have the bottom border). I have tried using the following code but the border is not drawn under the merged cells
Sub FormatTest()
With Sheets("Test")
With .Range("$B:$Z")
.FormatConditions.Add xlExpression, Formula1:="=mod(row(),2)=0"
With .FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
.FormatConditions(1).StopIfTrue = False
End With
End With
End Sub
Here is an example of what i want to achieve
I want to achieve this with conditional formatting because the number of rows will change from time to time and i don't want to have borders on empty cells.
The photo is just an example because there are many rows and on different sheets I will have a different number of columns so I just want to apply it to the whole row... Can anyone help?