I am currently working on a macro which formats horizontal lines either thin or medium depending on cell criteria of the leftmost column.
When the value of a cell in the leftmost column is different than the value of the cell below it , it places a medium thickness line between them. When the values are the same it draws a thin line.
It works fine when there are no filters applied, but it fails to take into account hidden rows.
I've tried some complicated methods to solve this problem but the coding becomes too difficult as I am inexperienced with VBA.
I'm wondering if there is a simple way to compare a cell to the next visible cell below it?
When the value of a cell in the leftmost column is different than the value of the cell below it , it places a medium thickness line between them. When the values are the same it draws a thin line.
It works fine when there are no filters applied, but it fails to take into account hidden rows.
Code:
Sub proFormatRows()
Range("B2").Select
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
Do Until ActiveCell.Value = 0
If ActiveCell.Value = ActiveCell.Offset(1, 0).Value Then
proThinLine
ElseIf ActiveCell.Value <> ActiveCell.Offset(1, 0).Value Then
proMediumLine
End If
Selection.Offset(1, 0).Select
Loop
End Sub
I've tried some complicated methods to solve this problem but the coding becomes too difficult as I am inexperienced with VBA.
I'm wondering if there is a simple way to compare a cell to the next visible cell below it?