★すっきりしたプログラムにコメントを!
Sub 罫線を引くぜ()
' 外枠と内側の罫線の種類
  Range("B2:D8").Select
  
With Selection.Borders(xlEdgeLeft)      '外枠左罫線
    .LineStyle = xlContinuous
    .Weight = xlThin
  
End With
  
With Selection.Borders(xlEdgeTop)      '外枠上罫線
    .LineStyle = xlContinuous
    .Weight = xlThin
  
End With
  
With Selection.Borders(xlEdgeBottom)     '外枠下罫線
    .LineStyle = xlContinuous
    .Weight = xlThin
  
End With
  
With Selection.Borders(xlEdgeRight)      '外枠右罫線
    .LineStyle = xlContinuous
    .Weight = xlThin
  
End With
  
With Selection.Borders(xlInsideVertical)   '内側垂直線
    .LineStyle = xlContinuous
    .Weight = xlHairline
  
End With
  
With Selection.Borders(xlInsideHorizontal)  '内側水平線
    .LineStyle = xlContinuous
    .Weight = xlHairline
  
End With
'表題の下の二重線
  Range("B2:D2").Select
  
With Selection.Borders(xlEdgeLeft)      '外枠左罫線
    .LineStyle = xlContinuous
    .Weight = xlThin
  
End With
  
With Selection.Borders(xlEdgeTop)       '外枠上罫線
    .LineStyle = xlContinuous
    .Weight = xlThin
  
End With
  
With Selection.Borders(xlEdgeBottom)     '外枠下罫線
    .LineStyle = xlDouble
    .Weight = xlThick
  
End With
  
With Selection.Borders(xlEdgeRight)     '外枠右罫線
    .LineStyle = xlContinuous
    .Weight = xlThin
  
End With
  
With Selection.Borders(xlInsideVertical)   '内側垂直線
    .LineStyle = xlContinuous
    .Weight = xlHairline
  
End With
'合計上の二重線
  Range("B7:D7").Select
  
With Selection.Borders(xlEdgeLeft)       '外枠左罫線
    .LineStyle = xlContinuous
    .Weight = xlThin
  
End With
  
With Selection.Borders(xlEdgeTop)      '外枠上罫線
    .LineStyle = xlContinuous
    .Weight = xlHairline
  
End With
  
With Selection.Borders(xlEdgeBottom)     '外枠下罫線
    .LineStyle = xlDouble
    .Weight = xlThick
  
End With
  
With Selection.Borders(xlEdgeRight)     '外枠右罫線
    .LineStyle = xlContinuous
    .Weight = xlThin
  
End With
  
With Selection.Borders(xlInsideVertical)  '内側垂直線
    .LineStyle = xlContinuous
    .Weight = xlHairline
  
End With
  Range("D8").Select
End Sub

 コメントを入れてみたら、いろいろ分かってきますね。
えっ!何が?って言わないで下さいよ。
ダブっているプログラムがあるでしょ。

表題の下と合計の上の二重線を引くためのプログラムの所にいろいろあるでしょ。
では、ダブっているものも削除しちゃえ!

[トップ][前へ][罫線マクロのコード][次へ]