| ©«¤l5923 ¥DÃD13 ºëµØ1 ¿n¤À5986 ÂI¦W0  §@·~¨t²Îwin10 ³nÅ骩¥»Office 2010 ¾\ŪÅv150 ©Ê§O¨k ¨Ó¦Û¥xÆW°ò¶© µù¥U®É¶¡2010-5-1 ³Ì«áµn¿ý2022-1-23 
         
 | 
                
| ¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-12-28 07:59 ½s¿è 
 ¦^´_ 14# alltest
 EX   ©ñ¦b book1 ·|¥X²{¿ù»~°T®§        book2 ·|¥X²{¿ù»~°T®§
 ¦p¹Ï :  book2 ¤u§@ªí¦WºÙ¿ù»~
 
 
 
     
 
 
 EX1  ©ñ¦b book1 ¥i¥H°õ¦æ¡A¦ý¥X²{ªºµ²ªG©Ç©Çªº»¡~
 
 ¦p¹Ï book1 ½Ð·s¼W¤@¤u§@ªí ©R¦W¬° : "ªíÀY"
 
 
 
     
 
 ×§ï Sub Ex1() ¦p¤U
 ½Æ»s¥N½XSub Ex1() '·s¼W¬¡¶Ã¯
Dim E As Variant, r As Integer, xi As Integer, xC As Integer
Dim Rng(1 To 2), Wb As Workbook
Set Wb = Workbooks.Add(1) '·s¼W¬¡¶Ã¯
With Workbooks("book1.xls").Sheets("²§±`©ú²Ó")
.AutoFilterMode = False
xC = .Cells(1, .Columns.Count).End(xlToLeft).Column
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 xC Step 3
Set Rng(1) = .Range("b3:d" & xi)
Set Rng(2) = .Range(.Cells(3, r).Resize(, IIf(r < xC - 1, 3, 2)).Address & ":" & .Cells(xi, r + IIf(r < xC - 1, 2, 1)).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
With ActiveSheet
If r < xC - 1 Then
Workbooks("book1.xls").Sheets("ªíÀY").[A1].CurrentRegion.Copy .[A1]
'book1 ½Ð·s¼W¤@¤u§@ªí ©R¦W¬° : "ªíÀY"
Else
Workbooks("book1.xls").Sheets("ªíÀY").[A4].CurrentRegion.Copy .[A1]
End If
Rng(1).Copy ActiveSheet.[A3]
End With
Next
Next
.AutoFilterMode = False
End With
Wb.Sheets(1).Move After:=Wb.Sheets(Wb.Sheets.Count)
Wb.Sheets(1).Activate
End Sub
 | 
 |