在VBA中,如何添加一组值并一次输出整个组?
基本上我希望做类似的事情:
Todays_Date = 9/1/15
If Compliance_Date1 = Todays_Date then
Collection.add “Compliance Date 1”
If Compliance_Date2 = Todays_Date then
Collection.add “Compliance Date 2”
If Compliance_Date3 = Todays_Date then
Collection.add “Compliance Date 3”
Output Entire Collection: Compliance Date 1 Compliance Date 2 Compliance Date 3
答案 0 :(得分:0)
如果您不知道如何使用收藏品,您可能希望留下一个字符串。
Dim strDateList as string
If Compliance_Date1 = Todays_Date then
strDateList = strDateList & “Compliance Date 1” & vbCrLf
If Compliance_Date2 = Todays_Date then
strDateList = strDateList & “Compliance Date 2” & vbCrLf
If Compliance_Date3 = Todays_Date then
strDateList = strDateList & “Compliance Date 3” & vbCrLf
然后"输出"
msgbox strDateList