伪代码:要存储值的集合从工作表
If a=b then
result= a . cells(start,1).value
end if
如果列有多个匹配,我怎么能一颗颗匹配值存储在一个变量?以及如何将它添加到输入框中,用户可以在该框中进行选择。
伪代码:要存储值的集合从工作表
If a=b then
result= a . cells(start,1).value
end if
如果列有多个匹配,我怎么能一颗颗匹配值存储在一个变量?以及如何将它添加到输入框中,用户可以在该框中进行选择。
为什么不使用数组? (此代码是完全未经测试)
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, "; ")
取决于你实际上试图但是实现它会给你更多的选择,然后只存储完整的结果在一个变量
这可能是一个有点矫枉过正If a=b then
result= result & ";" & a.cells(start,1).value
end if
你可以考虑串联的结果值(上面的例子展示了如何有一个分号是集结了A = B测试值的分隔字符串)
你可能需要张贴您的实际代码尽管如此,可以正确协助。
嗨,我已经分享了我的code.Please指导。 – user6124516
所以计数的概念只适用于数组? – user6124516
对不起 - 你的意思是? – Tom