Hi all,
Could someone help me to amend the below code?
I use the below code on as part of copying varies results to a new tab and applying a border. Some of these extracts have 5 columns some have 10 so i used A2:Z... but obviously this borders all cells from A:Z.
I want the code to only border columns as far as the last one with values, could someone help?
lr = Cells(Columns.Count, "A").End(xlUp).Row
Range("A2:Z" & lr).Select
Selection.EntireColumn.AutoFit
With Selection.Borders
.LineStyle = xlContinuous
.Color = vbBlack
.Weight = xlThin
End With
Could someone help me to amend the below code?
I use the below code on as part of copying varies results to a new tab and applying a border. Some of these extracts have 5 columns some have 10 so i used A2:Z... but obviously this borders all cells from A:Z.
I want the code to only border columns as far as the last one with values, could someone help?
lr = Cells(Columns.Count, "A").End(xlUp).Row
Range("A2:Z" & lr).Select
Selection.EntireColumn.AutoFit
With Selection.Borders
.LineStyle = xlContinuous
.Color = vbBlack
.Weight = xlThin
End With