即効テクニック

セル操作関連のテクニック

背景色をまとめて変換する

(Excel 97/2000)
サンプルマクロは、ブック内の背景色が黄色に設定されているセルの背景色をすべて緑に変更します。
Sub Sample()

Dim myCell As Range
Dim mySht As Worksheet

    For Each mySht In Worksheets
        For Each myCell In mySht.UsedRange
            With myCell.Interior
                If .ColorIndex = 6 Then .ColorIndex = 4
            End With
        Next
    Next
    
End Sub