Skip to content

Instantly share code, notes, and snippets.

@hedgejanuary
Created May 5, 2020 09:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hedgejanuary/7bf33a4ce640f6909404eb2827d18368 to your computer and use it in GitHub Desktop.
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