Return to Snippet

Revision: 61530
at December 20, 2012 02:56 by lolrenx

Initial Code
Public Sub Format_Headers(tgtRange As Range, Optional NoFill As Boolean, _
Optional ForceVertical As Boolean, Optional NoBold As Boolean)

If tgtRange Is Nothing Then _
    Exit Sub

With tgtRange
    .Interior.Pattern = xlSolid
    .Interior.ThemeColor = xlThemeColorDark1
    If Not NoFill Then .Interior.ColorIndex = 15
    If Not NoBold Then .Font.Bold = True Else .Font.Bold = False
    .Borders(xlDiagonalDown).LineStyle = xlNone
    .Borders(xlDiagonalUp).LineStyle = xlNone
    .Borders.LineStyle = xlContinuous
    If Not NoBold Then .Borders.Weight = xlMedium Else .Borders.Weight = xlThin
    If Not ForceVertical Then .Borders(xlInsideVertical).LineStyle = xlNone
End With
End Sub

Initial URL

Initial Description
quick way to get column headers formatted

Initial Title
Format Header Range

Initial Tags
header, format, excel

Initial Language
Visual Basic