R函数像这样返回1或0
RG
1
0
如果var1是>以var2为例。我想比较变量。
当我尝试这个时,它没关系:
Sub compare_sup_egal()
Dim v As Variant
Dim var1 As String
Dim var2 As String
With Worksheets("Parametre")
var1 = .Cells(19, 1).Value
var2 = .Cells(19, 3).Value
End With
Sheets.Add.Name = "test"
v = Application.Run("BERT.Call", "compare_sup_egal", var1, var2)
ActiveSheet.Range("A1:K130000").Value = v
End Sub
我试过这个宏
Sub test2()
Dim v As Variant
Dim var1 As Variant
Dim var2 As Variant
With Worksheets("Parametre")
Sheets.Add.Name = "test"
For i = 18 To 19
For j = 2 To 30000
For k = 2 to 3
If (Not IsEmpty(Range("A" & i))) Then
If (Range("B" & i) = ">") Then
var1 = .Cells(i, 1).Value
var2 = .Cells(i, 3).Value
v = Application.Run("BERT.Call", "compare_sup", var1, var2)
sheets("test").Cells(j,k).value = v
End If
If (Range("B" & i) = "<") Then
var1 = .Cells(i, 1).Value
var2 = .Cells(i, 3).Value
v = Application.Run("BERT.Call", "compare_inf", var1, var2)
sheets("test").Cells(j,k).value = v
End If
End If
Next k
Next j
Next i
End With
End Sub
我想知道给定var1的数据是&gt; var2或&lt; ! 用户给出var 1,var2和符号的值!
我想要这个结果:
RG
1
0
1
但我有这个:
RG
RG
RG
RG