Everyday I run a list, it is always different. It will have different amounts of rows with different values in them every day.
I have coded it so I have horizontal borders exactly as I want, but now I need the vertical (side - left and right) borders. I would like thin borders in every cell that contains text or a value of some kind, in every column and every row after including row 1. Again, the amount of rows and columns will vary every day, so it's important that the code can account for that.
Option Explicit
Sub Borders()
Dim WS As Worksheet
Dim dataRange As Range
Dim v As Variant, I As Long
Set WS = ActiveWorkbook.Worksheets("Sheet1")
With WS
Set dataRange = Range(.Cells(2, 1), Cells(.Rows.Count, 10).End(xlUp))
Set dataRange = dataRange.Resize(rowsize:=dataRange.Rows.Count + 1)
With dataRange
v = .Columns(10)
For I = 1 To UBound(v) - 1
If v(I, 1) <> v(I + 1, 1) Then
With .Rows(I).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Color = vbBlack
.Weight = xlMedium
End With
Else
.Rows(I).Borders(xlEdgeBottom).LineStyle = 1 'Default Border
End If
Next I
End With
End With
'This is where I'd like the code for the vertical borders to go
End Sub