Public Sub Test()
Dim lLastRow As Long
Dim lLastCol As Long
Dim oTarget As Range
lLastRow = ActiveSheet.Cells.Find(what:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
lLastCol = ActiveSheet.Cells.Find(what:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
Set oTarget = ActiveSheet.Range("B2:" & ActiveSheet.Cells(lLastRow, lLastCol).Address)
With oTarget.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With oTarget.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With oTarget.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With oTarget.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End Sub
I just need borders around the one row (row2) It now goes up and gets b1 and draws borders around the entire range.
Sub BorderAroundFirstRowLastColumn()
Dim LastRow As Long, LastCol As Long
LastRow = ActiveSheet.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row
LastCol = ActiveSheet.Cells.Find(What:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Column
Range(Cells(2, 2), Cells(2, LastCol)).BorderAround xlContinuous, xlThick
Range(Cells(2, LastCol), Cells(LastRow, LastCol)).BorderAround xlContinuous, xlThick
End Sub