| 
    
     |  | 横長のカレンダーで、C5からAG5まで曜日が入れてあり、曜日は月を変えると関数で変わるようにしてあります。土日の4列から31列まで自動的に青太の罫線で囲むようにしたいのですが、条件付き書式は使い切っているのでマクロを使うことにしました。 なんとか以下のコードで動かすことができましたが、とても遅いのです。
 自分でも色々省略したのですが、他に方法がありましたらご指導お願いいたします。
 (変数宣言より上の行は罫線の初期化をしています。)
 
 Range(Cells(4, 3), Cells(31, 33)).Select
 Selection.Borders(xlDiagonalDown).LineStyle = xlNone
 Selection.Borders(xlDiagonalUp).LineStyle = xlNone
 With Selection.Borders(xlEdgeLeft)
 .Weight = xlHairline
 .ColorIndex = xlAutomatic
 End With
 With Selection.Borders(xlEdgeTop)
 .Weight = xlThin
 .ColorIndex = xlAutomatic
 End With
 With Selection.Borders(xlEdgeBottom)
 .Weight = xlThin
 .ColorIndex = xlAutomatic
 End With
 With Selection.Borders(xlEdgeRight)
 .Weight = xlHairline
 .ColorIndex = xlAutomatic
 End With
 With Selection.Borders(xlInsideVertical)
 .Weight = xlHairline
 .ColorIndex = xlAutomatic
 End With
 
 Dim kei As Integer
 For kei = 3 To 33
 Select Case Cells(5, kei)
 Case Is = 7
 Range(Cells(4, kei), Cells(31, kei)).Select
 With Selection.Borders(xlEdgeLeft)
 .Weight = xlMedium
 .ColorIndex = 11
 End With
 With Selection.Borders(xlEdgeTop)
 .Weight = xlMedium
 .ColorIndex = 11
 End With
 With Selection.Borders(xlEdgeBottom)
 .Weight = xlMedium
 .ColorIndex = 11
 End With
 
 Case Is = 1
 Range(Cells(4, kei), Cells(31, kei)).Select
 With Selection.Borders(xlEdgeTop)
 .Weight = xlMedium
 .ColorIndex = 11
 End With
 With Selection.Borders(xlEdgeBottom)
 .Weight = xlMedium
 .ColorIndex = 11
 End With
 With Selection.Borders(xlEdgeRight)
 .Weight = xlMedium
 .ColorIndex = 11
 End With
 End Select
 Next kei
 
 
 |  |