I have written code to insert borders on all sheets from row 9 up to the row before where total appears in Col A (could be total repairs, total expenses etc)
I need the borders to be from Col a to the last Column Containing Text in Row 9.
Your assistance is much appreciated
I need the borders to be from Col a to the last Column Containing Text in Row 9.
Your assistance is much appreciated
Code:
Sub Borders_All_Sheets()
Application.ScreenUpdating = False
Dim lngLstCol As Long, lngLstRow As Long
lngLstRow = ActiveSheet.UsedRange.Rows.Count
lngLstCol = ActiveSheet.UsedRange.Columns.Count
For Each rngCell In Range("A9:A" & lngLstRow)
If rngCell.Value > "" Then
r = rngCell.Row
c = rngCell.Column
Range(Cells(r, c), Cells(r, lngLstCol)).Select
With Selection.Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End If
Next
Application.ScreenUpdating = True
End Sub