トップページ(目次)

167.罫線を引く②

<実行前後>
 → 
Sub 罫線を引く②()

    With Range("B2:C3")
        .Borders(xlEdgeTop).LineStyle = xlContinuous '上
        .Borders(xlEdgeBottom).LineStyle = xlContinuous '下
        .Borders(xlEdgeRight).LineStyle = xlContinuous '右
        .Borders(xlEdgeLeft).LineStyle = xlContinuous '左
        .Borders(xlInsideVertical).LineStyle = xlContinuous '中の縦
        .Borders(xlInsideHorizontal).LineStyle = xlContinuous '中の横
    End With
    
End Sub
上・下・右・左・中の縦・中の横 と順番に線を引いているので、中の縦・中の横 を外せば外枠だけに線を引ける
Sub 罫線を引く_外枠だけ()

    With Range("B2:C3")
        .Borders(xlEdgeTop).LineStyle = xlContinuous '上
        .Borders(xlEdgeBottom).LineStyle = xlContinuous '下
        .Borders(xlEdgeRight).LineStyle = xlContinuous '右
        .Borders(xlEdgeLeft).LineStyle = xlContinuous '左
    End With
    
End Sub

Copyright © 2021 https://excel3000.web.fc2.com/ All Rights Reserved.
    inserted by FC2 system