| 
    
     |  | こんばんは。 
 >>Sub add_formatcondition()
 >>  With Columns(1)
 >>    .FormatConditions.Delete
 >>    With .FormatConditions.Add( _
 >>        Type:=xlExpression, Formula1:= _
 >>        "=COUNTIF(c1,rc)>1")
 >>      .Interior.ColorIndex = 3
 >>      End With
 >>    End With
 >>End Sub
 >
 >返信遅くなりまして、すみません。
 >これでいけるかなと思います!
 >countifについて調べていますが、
 >「COUNTIF(c1,rc)>1」
 >はAの行をしらべるのになぜc1とrcでくくってあるのですかね?
 ちょっと紛らわしいですね!!
 これ、R1C1形式でセル範囲を表しています。
 
 C1は、1列目のセル RCは、カレントのセル
 
 新規ブックの標準モジュールで
 
 Sub disp_address()
 With Columns(1)
 MsgBox .Address(, , xlR1C1)
 End With
 End Sub
 
 これを実行してみてください。
 
 C1と表示されます。
 
 A1形式で記述すると、
 
 Sub add_formatcondition2()
 With Columns(1)
 .Cells(1).Activate
 .FormatConditions.Delete
 With .FormatConditions.Add( _
 Type:=xlExpression, Formula1:= _
 "=COUNTIF($a:$a,a1)>1")
 .Interior.ColorIndex = 3
 End With
 End With
 End Sub
 
 ↑このコードと前回の投稿したコードでは、A列に設定される
 条件付書式は同じです。
 
 |  |