Good morning/afternoon.
If someone has some time to help, I would appreciate it.
So, I've been using this code to find my longest row/column range so I can put 'all borders' around each cell in that range. However, on this last report, it doesn't seem to see the last two rows. Not sure why. My header row is on row 5 and there is something in every cell in column A and there are 10 columns.
I found this two lines, that sound like they should/might work, but I don't know how to substitute them in.
UsedCol = ThisWorkbook.ActiveSheet.UsedRange.SpecialCells(x1CellTypeLastCell).Column
UsedRow = ThisWorkbook.ActiveSheet.UsedRange.SpecialCells(x1CellTypeLastCell).Row
This is what works most of the time but won't see the last two rows of my current data range.
If someone has some time to help, I would appreciate it.
So, I've been using this code to find my longest row/column range so I can put 'all borders' around each cell in that range. However, on this last report, it doesn't seem to see the last two rows. Not sure why. My header row is on row 5 and there is something in every cell in column A and there are 10 columns.
I found this two lines, that sound like they should/might work, but I don't know how to substitute them in.
UsedCol = ThisWorkbook.ActiveSheet.UsedRange.SpecialCells(x1CellTypeLastCell).Column
UsedRow = ThisWorkbook.ActiveSheet.UsedRange.SpecialCells(x1CellTypeLastCell).Row
This is what works most of the time but won't see the last two rows of my current data range.
Code:
Sub AllBordersEvenBlanks5()
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("A5: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
End Sub