伪代码:
If a=b then
result= a . cells(start,1).value
end if
如果列有多个匹配项,如何将这些匹配值存储在变量中?如何在输入框中添加它,用户可以在提示时将其添加到输入框中。
答案 0 :(得分:0)
If a=b then
result= result & ";" & a.cells(start,1).value
end if
您可以考虑连接结果值(上面的示例显示了如何使用以分号分隔的值的字符串来聚合a = b测试)
您可能需要发布实际代码,因此可以正确协助。
答案 1 :(得分:0)
为什么不使用数组? (此代码完全未经测试)
Dim arrCount as Long
Dim temp() as Variant
arrCount = 1
If a = b then
ReDim Preserve temp(1 to arrCount)
temp(arrCount) = a.cells(start,1).value
arrCount = arrCount + 1
End If
' Concatenate array together and separate by a semi-colon and a space for the delimiter character
InputBox.Value = Join(temp, "; ")
这可能有点矫枉过正,取决于你实际想要实现的目标,但它会为你提供更多选择,然后将完整的结果存储在变量中