ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð°Ý¦³¤H¯àÀ°¦£¸Ñµª¶Ü?¨ç¼Æ¤½¦¡¸Ó¦p¦ó¼g©O?

¦^´_ 6# alltest
¦Û°Ê¿z¿ï:
  1. Sub Ex()
  2.     Dim E As Variant, r As Integer, xi As Integer
  3.     Dim Rng(1 To 2)
  4.     With Workbooks("book1.xls").Sheets("²§±`©ú²Ó")
  5.         .AutoFilterMode = False
  6.         For Each E In Array("¶À¦â", "¬õ¦â", "«C¦â")
  7.             .Range("A2", .UsedRange.SpecialCells(xlCellTypeLastCell).Address).AutoFilter Field:=2, Criteria1:=E
  8.             xi = .Cells(Rows.Count, 2).End(xlUp).Row
  9.             For r = 5 To .Cells(1, .Columns.Count).End(xlToLeft).Column Step 3
  10.                 Set Rng(1) = .Range("b1:d" & xi)
  11.                 Set Rng(2) = .Range(.Cells(1, r).Resize(, 3).Address & ":" & .Cells(xi, r + 2).Address)
  12.                 Set Rng(1) = Union(Rng(1), Rng(2))
  13.                 With Workbooks("book2.xls").Sheets(E & "-" & .Cells(1, r))
  14.                     .Cells.Clear
  15.                     Rng(1).Copy .[A1]
  16.                 End With
  17.             Next
  18.         Next
  19.         .AutoFilterMode = False
  20.     End With
  21. End Sub
½Æ»s¥N½X
  1. Sub Ex1() '·s¼W¬¡­¶Ã¯
  2.     Dim E As Variant, r As Integer, xi As Integer
  3.     Dim Rng(1 To 2), Wb As Workbook
  4.     Set Wb = Workbooks.Add(1)                                           '·s¼W¬¡­¶Ã¯
  5.     With Workbooks("book1.xls").Sheets("²§±`©ú²Ó")
  6.         .AutoFilterMode = False
  7.         For Each E In Array("¶À¦â", "¬õ¦â", "«C¦â")
  8.             .Range("A2", .UsedRange.SpecialCells(xlCellTypeLastCell).Address).AutoFilter Field:=2, Criteria1:=E
  9.             xi = .Cells(Rows.Count, 2).End(xlUp).Row
  10.             For r = 5 To .Cells(1, .Columns.Count).End(xlToLeft).Column Step 3
  11.                 Set Rng(1) = .Range("b1:d" & xi)
  12.                 Set Rng(2) = .Range(.Cells(1, r).Resize(, 3).Address & ":" & .Cells(xi, r + 2).Address)
  13.                 Set Rng(1) = Union(Rng(1), Rng(2))
  14.                 Wb.Sheets.Add(, Sheets(Sheets.Count)).Name = E & "-" & .Cells(1, r) '·s¼W¤u§@ªí:©R¦W
  15.                 Rng(1).Copy ActiveSheet.[A1]
  16.             Next
  17.         Next
  18.         .AutoFilterMode = False
  19.     End With
  20. End Sub
½Æ»s¥N½X

TOP

¦^´_ 10# alltest
Ex ©ñ­þ¸Ì³£¥i¥H
Ex1 (·s¼W¬¡­¶Ã¯)»Ý©ñ¦bbook1.xls ©Î¥H¦sÀɪº¬¡­¶Ã¯¤¤

TOP

¦^´_ 12# alltest
EX   ©ñ¦b book1 ·|¥X²{¿ù»~°T®§          book2 ·|¥X²{¿ù»~°T®§
§Aªº book1,book2 ¤W¶Ç¬Ý¬Ý.
EX1  ©ñ¦b book1 ¥i¥H°õ¦æ¡A¦ý¥X²{ªºµ²ªG©Ç©Çªº»¡~
¦p¦ó©Ç©Ç, ½Ð»¡¬Ý¬Ý.

TOP

¥»©«³Ì«á¥Ñ 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
  1. Sub Ex1() '·s¼W¬¡­¶Ã¯
  2. Dim E As Variant, r As Integer, xi As Integer, xC As Integer
  3. Dim Rng(1 To 2), Wb As Workbook
  4. Set Wb = Workbooks.Add(1) '·s¼W¬¡­¶Ã¯
  5. With Workbooks("book1.xls").Sheets("²§±`©ú²Ó")
  6. .AutoFilterMode = False
  7. xC = .Cells(1, .Columns.Count).End(xlToLeft).Column
  8. For Each E In Array("¶À¦â", "¬õ¦â", "«C¦â")
  9. .Range("A2", .UsedRange.SpecialCells(xlCellTypeLastCell).Address).AutoFilter Field:=2, Criteria1:=E
  10. xi = .Cells(Rows.Count, 2).End(xlUp).Row
  11. For r = 5 To xC Step 3
  12. Set Rng(1) = .Range("b3:d" & xi)
  13. 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)
  14. Set Rng(1) = Union(Rng(1), Rng(2))
  15. Wb.Sheets.Add(, Sheets(Sheets.Count)).Name = E & "-" & .Cells(1, r) '·s¼W¤u§@ªí:©R¦W
  16. With ActiveSheet
  17. If r < xC - 1 Then
  18. Workbooks("book1.xls").Sheets("ªíÀY").[A1].CurrentRegion.Copy .[A1]
  19. 'book1 ½Ð·s¼W¤@¤u§@ªí ©R¦W¬° : "ªíÀY"
  20. Else
  21. Workbooks("book1.xls").Sheets("ªíÀY").[A4].CurrentRegion.Copy .[A1]
  22. End If
  23. Rng(1).Copy ActiveSheet.[A3]
  24. End With
  25. Next
  26. Next
  27. .AutoFilterMode = False
  28. End With
  29. Wb.Sheets(1).Move After:=Wb.Sheets(Wb.Sheets.Count)
  30. Wb.Sheets(1).Activate
  31. End Sub
½Æ»s¥N½X

TOP

¦^´_ 18# c_c_lai
«K OK ¤F¡I (  Rows.Count  ---->  .Rows.Count )
¨Ï¥Î2003(¦Ñª©¥»)§Ñ°O¤F,2007ª©(§t)¥H¤W Rows.Count , ¥²»Ý¦p¦¹ . .Rows.Count

TOP

        ÀR«ä¦Û¦b : «Ý¤H°h¤@¨B¡A·R¤H¼e¤@¤o¡A´N·|¬¡±o«Ü§Ö¼Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD