2016-04-08 16 views
0

私はVBAの問題があります。私はIf文を書いて、A> = Bならば0、そうでなければB-Aを新しい列に書いておきたい。私はこれを最後の行まで繰り返す必要があります。誰もがこのif then文に必要なVBAヘルプ

答えて

1

に私を助けることができる方法について:

Sub qwerty() 
    Dim N As Long, r As Range 

    N = Cells(Rows.Count, "A").End(xlUp).Row 
    Set r = Range("C1:C" & N) 
    r.Formula = "=IF(A1>=B1,0,B1-A1)" 
End Sub 

enter image description here