Format Header Range


/ Published in: Visual Basic
Save to your folder(s)

quick way to get column headers formatted


Copy this code and paste it in your HTML
  1. Public Sub Format_Headers(tgtRange As Range, Optional NoFill As Boolean, _
  2. Optional ForceVertical As Boolean, Optional NoBold As Boolean)
  3.  
  4. If tgtRange Is Nothing Then _
  5. Exit Sub
  6.  
  7. With tgtRange
  8. .Interior.Pattern = xlSolid
  9. .Interior.ThemeColor = xlThemeColorDark1
  10. If Not NoFill Then .Interior.ColorIndex = 15
  11. If Not NoBold Then .Font.Bold = True Else .Font.Bold = False
  12. .Borders(xlDiagonalDown).LineStyle = xlNone
  13. .Borders(xlDiagonalUp).LineStyle = xlNone
  14. .Borders.LineStyle = xlContinuous
  15. If Not NoBold Then .Borders.Weight = xlMedium Else .Borders.Weight = xlThin
  16. If Not ForceVertical Then .Borders(xlInsideVertical).LineStyle = xlNone
  17. End With
  18.  
  19. End Sub

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.