[英]Comparison isn't finding as true; but values sent to MsgBox show it should be
這是我的代碼的一部分。
'Loop through each SOP audit file
For Each oFile In oFiles
'MsgBox (RemoveLeadingZeroes(Split(oFile.Name, "-")(2)))
'Loop through all SOP IDs stored in COL A
For Each cel In SOPID
MsgBox (RemoveLeadingZeroes(Split(oFile.Name, "-")(2)) & " : " & cel)
'See if SOP ID in COL A matches SOP ID in Audit file name
If RemoveLeadingZeroes(Split(oFile.Name, "-")(2)) = cel Then
MsgBox ("Match found on SOP ID: " & cel)
End If
Next cel
Next oFile
這是使用該行比較的值的屏幕截圖...
MsgBox (RemoveLeadingZeroes(Split(oFile.Name, "-")(2)) & " : " & cel)
如果兩個值實際上都匹配,為什么If()語句不觸發MsgBox表示存在匹配? 是否將其中一個視為字符串,將另一個值視為范圍? 會影響嗎?
使用Trim()刪除空格。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.