两个VBA变量具有相同的值和类型,但在检查它们是否相等时,VBA返回false

时间:2017-05-04 12:32:10

标签: excel vba

我从excel中提取一个值并循环显示从bluezone拉出的值,直到匹配为止。我在两个表达式上设置监视,当两个变量都是130时,两个类型都是变量/字符串但表达式仍然不满足。为什么会这样?

Sub costinfo()  

Dim scrnobj As Object  
Set scrnobj = CreateObject("BZWhll.WhllObj")
scrnobj.Connect ""
lastrow = Application.WorksheetFunction.CountA(Range("A:A"))
Range("A3:A" & lastrow).Select
For Each c In Selection
    c.Activate
    vnrow = c.Row
    If Cells(vnrow, 12).Value = "" Then
        If Cells(vnrow, 11).Value <> "" Then
            partno = Cells(vnrow, 8).Value
            QTY = Cells(vnrow, 13).Value
            OPno = Trim(Cells(vnrow, 9).Value)
            found = False
         If OPno <> "" Then
            scrnobj.SendKeys ("<Clear>")
            scrnobj.waitforready 
            scrnobj.SendKeys ("<Clear>")
            scrnobj.SendKeys ("EL10")
            scrnobj.SendKeys ("<Enter>")
            scrnobj.waitforready

            scrnobj.writescreen partno & Space(25 - Len(partno)), 24, 30 
            scrnobj.writescreen Space(18), 24, 62
            scrnobj.SendKeys ("<Enter>")
            scrnobj.waitforready

 Do Until found
                For extrarow = 6 To 23

                    If scrnobj.readscreen(pOPno, 3, extrarow, 2) = OPno Then  ' this is not working
                        MsgBox "found"
                        found = True


                End If
                Next extrarow

0 个答案:

没有答案