应用程序匹配不匹配在一个电子表格中,而不是另一个电子表格中不匹配



所以我在 excel 电子表格中有一行 VBA,它给了我错误类型不匹配

Dim INST As Worksheet
Set INST = Sheets("Instructions")
Dim ST1 As Worksheet
Set ST1 = Sheets("DataU1")
'C12 = 99.8 
' The ST1 range are column of numbers that look like 99.8053741455, 99.8193664551, 100.000717163, etc. These numbers are in numerical order
Dataedge = Application.Match(INST.Range("C12"), ST1.Range("B:B"), 1)

上面的代码给了我一个类型不匹配错误,虽然有更多的代码,但这只是这个,它不应该对这行代码产生影响。

当我用不同的数字制作自己的工作表时,它可以工作。

Sub Button1_Click()
Dim INST As Worksheet
Set INST = Sheets("Sheet1")
Dim ST1 As Worksheet
Set ST1 = Sheets("Sheet2")
'C12 = 38.2
'Numbers in the range are 31.5, 32.5, 34.1, 36.9, 37.23, 38.51, 39.1
Dataedge = Application.Match(Val(INST.Range("C12")), ST1.Range("B:B"), 1)
If IsNumeric(Dataedge) = True Then
MsgBox (Dataedge)
'MsgBox Returns 5 
Else
MsgBox ("NA")
End If
End Sub
``
The above code gives back 5 as it should. Does anyone know what the problem could be?

找到了答案。数据已被删除。

相关内容

  • 没有找到相关文章

最新更新