|
楼主 |
发表于 2022-9-17 17:15
|
显示全部楼层
本帖最后由 cmo9020 于 2022-10-19 20:52 编辑
Private Sub CommandButton1_click()
Dim ctr, ss$, aa, j%, d, k, t, b1$, b2$, s$
Set d = CreateObject("Scripting.Dictionary")
For Each ctr In CommandButton1.Parent.Controls
If InStr(ctr.Name, "ListBox2") Then
If ctr.Value Then
ss = ss & ctr.Caption & ","
End If
End If
Next
If ss <> "" Then
ss = Left(ss, Len(ss) - 1)
aa = Split(ss, ",")
For j = 0 To UBound(aa)
n = InStr(aa(j), "-")
b1 = Left(aa(j), n - 1)
b2 = Mid(aa(j), n + 1)
d(b1) = d(b1) & b2 & "."
Next
k = d.keys: t = d.items
For i = 0 To UBound(k)
s = s & k(i) & "-"
t(i) = Left(t(i), Len(t(i)) - 1)
If InStr(t(i), ",") Then
aa = Split(t(i), ",")
For j = 0 To UBound(aa)
s = s & aa(j) & "."
Next
s = Left(s, Len(s) - 1)
s = s & "、"
Else
s = s & t(i) & "、"
End If
Next
s = Left(s, Len(s) - 1)
[E6] = s
End If
End Sub
|
|