|
例えばセルの四辺が各々、直線×4(-8280),点と直線×4(-8268),点×4(-24756)
の罫線で囲まれている(数値は LineStyle の数値定数の合計)場合
Sub MyLineStyle()
Dim C As Range
Dim X As Long, Col As Long
For Each C In ActiveSheet.UsedRange
X = 0: Col = 0
For Each B In C.Borders
X = X + B.LineStyle
Next
Debug.Print X
Select Case X
Case -8280: Col = 5
Case -8268: Col = 3
Case -24756: Col = 6
End Select
If Col > 0 Then C.Interior.ColorIndex = Col
Next
End Sub
なお数値定数の合計は、四辺を同じ種類の罫線で囲っているセルを1つ選択し
Sub Test()
Dim X As Long
For Each B In ActiveCell.Borders
X = X + B.LineStyle
Next
MsgBox X
End Sub
を実行すれば、取得できます。
|
|