When formatting a Excel sheet underlining or overlining (which appears as if you underlined the cell above) a cell often looks much better than just underlining the contents of the cell (ctrl-u). This macro will toggle the under/overlines for all the selected sells.
' Toggles Underlines ' [% coypright %] ' Keyboard Shortcur: Crtl+Shift+U ' Sub mgSetUnderline() If Selection.Borders(xlBottom).LineStyle = xlNone Then With Selection.Borders(xlBottom) .Weight = xlThin .ColorIndex = xlAutomatic End With Else Selection.Borders(xlBottom).LineStyle = xlNone End If End Sub
' Toggles Overlines ' Copyright under GPL by Mark Grimes ' Keyboard Shortcur: Crtl+Shift+O ' Sub mgSetAnOverline() If Selection.Borders(xlTop).LineStyle = xlNone Then With Selection.Borders(xlTop) .Weight = xlThin .ColorIndex = xlAutomatic End With Else Selection.Borders(xlTop).LineStyle = xlNone End If End Sub
The contents of this blog are licensed under the Creative Commons “Attribution-Noncommercial-Share Alike 3.0″ license.