画像のようにA列の「№」が異なる場合で、交互に塗りつぶしをしたいと考えております。(データ行1000行以上可変)
条件付書式、VBAマクロなどの方法で実現する方法を具体的にお教えください。
よろしくお願いいたします。
A列が空白になるまで繰り返されます。
y=行数
x=列数
なので色を付ける範囲をE列まで付けるのであればx=5としてください。
Sub macro1() y = 2 x = 3 Do Until Cells(y, 1) = "" If Cells(y, 1) = Cells(y - 1, 1) Then Range(Cells(y, 1), Cells(y, x)).Interior.ColorIndex = Cells(y - 1, 1).Interior.ColorIndex Else If Cells(y - 1, 1).Interior.ColorIndex <> 48 Then Range(Cells(y, 1), Cells(y, x)).Interior.ColorIndex = 48 End If End If y = y + 1 Loop End Sub
完璧です。ありがとうございます。