- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 6# alltest
¦Û°Ê¿z¿ï:- Sub Ex()
- Dim E As Variant, r As Integer, xi As Integer
- Dim Rng(1 To 2)
- With Workbooks("book1.xls").Sheets("²§±`©ú²Ó")
- .AutoFilterMode = False
- For Each E In Array("¶À¦â", "¬õ¦â", "«C¦â")
- .Range("A2", .UsedRange.SpecialCells(xlCellTypeLastCell).Address).AutoFilter Field:=2, Criteria1:=E
- xi = .Cells(Rows.Count, 2).End(xlUp).Row
- For r = 5 To .Cells(1, .Columns.Count).End(xlToLeft).Column Step 3
- Set Rng(1) = .Range("b1:d" & xi)
- Set Rng(2) = .Range(.Cells(1, r).Resize(, 3).Address & ":" & .Cells(xi, r + 2).Address)
- Set Rng(1) = Union(Rng(1), Rng(2))
- With Workbooks("book2.xls").Sheets(E & "-" & .Cells(1, r))
- .Cells.Clear
- Rng(1).Copy .[A1]
- End With
- Next
- Next
- .AutoFilterMode = False
- End With
- End Sub
½Æ»s¥N½X- Sub Ex1() '·s¼W¬¡¶Ã¯
- Dim E As Variant, r As Integer, xi As Integer
- Dim Rng(1 To 2), Wb As Workbook
- Set Wb = Workbooks.Add(1) '·s¼W¬¡¶Ã¯
- With Workbooks("book1.xls").Sheets("²§±`©ú²Ó")
- .AutoFilterMode = False
- For Each E In Array("¶À¦â", "¬õ¦â", "«C¦â")
- .Range("A2", .UsedRange.SpecialCells(xlCellTypeLastCell).Address).AutoFilter Field:=2, Criteria1:=E
- xi = .Cells(Rows.Count, 2).End(xlUp).Row
- For r = 5 To .Cells(1, .Columns.Count).End(xlToLeft).Column Step 3
- Set Rng(1) = .Range("b1:d" & xi)
- Set Rng(2) = .Range(.Cells(1, r).Resize(, 3).Address & ":" & .Cells(xi, r + 2).Address)
- Set Rng(1) = Union(Rng(1), Rng(2))
- Wb.Sheets.Add(, Sheets(Sheets.Count)).Name = E & "-" & .Cells(1, r) '·s¼W¤u§@ªí:©R¦W
- Rng(1).Copy ActiveSheet.[A1]
- Next
- Next
- .AutoFilterMode = False
- End With
- End Sub
½Æ»s¥N½X |
|