'範囲内に一括で罫線を引く例です。
Sub 範囲内に格子に罫線を引く()
With Range("A1:E10").Borders
.Weight = xlThin
.ColorIndex = 3
End With
End Sub
'範囲内の周囲だけに罫線を引く例です。
Sub 範囲内の周囲に罫線を引く()
Range("A1:E10").BorderAround Weight:=xlThin, ColorIndex:=3
End Sub
'範囲内に横線のみ引く例です。
Sub 範囲内に横線を罫線を引く()
With Range("A1:E10").Borders(xlInsideHorizontal)
.Weight = xlThin
.ColorIndex = 3
End With
End Sub
'範囲内の「a」が入力されているセルを赤色の罫線で×印する例です。
Sub 特定のセルのみ斜線の赤色にする()
Dim C As Range
For Each C In Range("A1:E10")
If C.Value = "a" Then
With C.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 3
End With
With C.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 3
End With
End If
Next C
End Sub