Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Format simple table in excel.
Sub simpleTblFormat()
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.Color = rgbBlack
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.Color = rgbBlack
End With
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.Color = rgbBlack
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.Color = rgbBlack
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlHairline
.Color = rgbBlack
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlHairline
.Color = rgbBlack
End With
'Format the header row.
Selection.Resize(1, Selection.Columns.Count).Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.Color = rgbBlack
End With
With Selection
.Interior.Color = RGB(217, 217, 217)
.Font.Bold = True
End With
Selection.Resize(1, 1).Select
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.