这是我代码的一部分。
'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表示匹配呢?是否将其中一个视为字符串,将另一个值视为范围?会影响吗?
答案 0 :(得分:0)
使用Trim()删除空格。