If the region around which you want to put the border contains no blank rows or blank columns but column Z is blank then
With Range("A1").CurrentRegion
.Borders.LineStyle = xlNone ' clear current borders
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
if the assumptions I made are not valid then replace the first line with
With Range("A1",Cells(Cells(Rows.Count,"A").End(xlUp).Row, "Y"))
Bill Manville. Excel MVP, Oxford, England. www.manville.org.uk