|
こんな感じで、できると思います。
Sub HikakuSa()
Dim Cdata As Integer
Dim RetSt As String
Const Pmt As String = _
"A列の数字とB列の数字の比較をする" & vbLf & _
"数字を入力してください"
Const Ttl As String = "A列数字>B列数字の比較"
With Application
.DisplayAlerts = False
Cdata = .InputBox(Pmt, Ttl, Type:=1)
.DisplayAlerts = True
End With
If Cdata = 0 Then Exit Sub
RetSt = """" & Cdata & "以上の差があります" & """"
With Range("A6", Range("A65536").End(xlUp)).Offset(, 2)
.ClearContents
.Formula = _
"=IF($A6-$B6>=" & Cdata & "," & RetSt & ","""")"
.Value = .Value
End With
End Sub
|
|