- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 1# Michelle-W
¸Õ¸Õ¬Ý¡I- Sub Ex()
- Dim lg As Variant, ctn As Variant, xi As Integer
- Dim dic As Object, sp As Variant, sh As Worksheet
-
- Set sh = Worksheets("05¤ë")
- Set dic = CreateObject("scripting.dictionary")
-
- With sh
- For Each lg In .Range("B1:I1")
- .Select
-
- dic(lg.Value) = ""
- For Each ctn In .Range("A2:A7")
- If ctn.Offset(, lg.Column - 1) = "V" Then
- dic(lg.Value) = dic(lg.Value) + IIf(dic(lg.Value) = "", "", ",") + ctn.Value
- End If
- Next
- sp = Split(dic(lg.Value), ",")
- ' Cells(15, lg.Column).Resize(UBound(sp) + 1) = Application.Transpose(Array(sp)) ' ®i¥Ü¥Î
-
- For xi = 1 To Worksheets.Count
- If Worksheets(xi).Name = lg.Value Then Worksheets(xi).Select: Exit For
- Next xi
- If xi > Worksheets.Count Then
- Sheets.Add After:=Sheets(Worksheets.Count)
- ActiveSheet.Name = lg.Value
- End If
- With Worksheets(lg.Value)
- .[A1] = sh.[A1]
- .[B1] = lg.Value
- .[A2].Resize(UBound(sp) + 1) = Application.Transpose(Array(sp))
- .[B2].Resize(UBound(sp) + 1) = "V"
- End With
- Next
- End With
- End Sub
½Æ»s¥N½X |
|