For this requirement this is what I did.
1 Started recording the macro
2 Selected the cell F1
3 Keeping the Shift Key pressed, striked End and Down Arrow Key
so that I selected till the last non-empty cell (the one before the first empty cell) in F
column
4 Keeping the Shift Key pressed, striked the Home key so that I got
the entire block including A-D columns
5 Formatted the selected cells with borders
6 Stopped recording the macro
7 Here is the result
Sub Macro2()
Range("F1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub
rgds
johnjohns
Bookmarks