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

[µo°Ý] ¥HA2Àx¦s®æ¬°ÀɦW,°µ¦¨¤p­p³øªí

¦^´_ 6# Hsieh

¤j¤j,

·PÁ§A¦A¦¸ªºÀ°¦£.
¥X²{¤FÂI¤p°ÝÃD,¦]¬°¨C­Ó³øªí­n°Ï¤À¦UºØ¤£¦Pªº©â¤ô¾÷,©Ò¦³·|¦³¦U¦¡¦U¼ËªºÀɦW,§Ú·Q©µ¥Î³Ìªìªº·§©À,±NÀɦW³]¦b¥H¤UªºA2Àx¦s®æ¤¤,
1)  ½Ð°Ý¦b§A¼gªºµ{¦¡¤¤,§Ú­n«ç»ò±N¥H¤Uªº¥y¤l®M¶iµ{¦¡¤¤?
    With Workbooks(ThisWorkbook.Sheets("VBA").[A2].Value).Sheets("³øªí")
2) §Ú·Q±N½u§ï¦¨³Ì²Êªº½u,¬O§_§ï³o¥y?À³¸Ó«ç»ò§ï?     For Each A In .Cells 'µe®Ø½u

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2013-4-29 23:33 ½s¿è

¦^´_ 5# PJChen
  1. Sub Ex()
  2. Workbooks("a.xlsx").Sheets("³øªí").Copy '§â³øªí½Æ»s¨ì·sÀÉ®×
  3. Workbooks("a.xlsx").Close 0 'Ãö³¬a.xlsx
  4. Application.DisplayAlerts = False 'Ãö³¬¹ï¸Ü¤è¶ô
  5. ActiveWorkbook.SaveAs "D:\©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.xlsx" '±N·sÀÉÀx¦s
  6. With Workbooks("©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.xlsx") '³øªí·sÀÉ®×
  7. With .Sheets("³øªí")
  8. .UsedRange = .UsedRange.Value '¥h°£¤½¦¡
  9. .Range("A1").CurrentRegion.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=Array(10, 11), _
  10.         Replace:=True, PageBreaks:=False, SummaryBelowData:=True '¤w³sÄò¤é´Á¤À²Õ¤p­p
  11. .[A:D].Delete '§R°£A:DÄæ¦ì
  12. If .[B3] = "" Then .Rows(3).Delete
  13. With .Range("F:F").SpecialCells(xlCellTypeFormulas)
  14. .Offset(, -1) = "­p"
  15. For Each A In .Cells 'µe®Ø½u
  16.    For i = 7 To 10
  17.        A.Offset(, -1).Resize(, 3).Borders(i).Weight = xlMedium
  18.        A.Offset(, -1).Resize(, 3).Borders(i).ColorIndex = 3
  19.    Next
  20. Next
  21. End With
  22. .UsedRange = .UsedRange.Value '¥h°£¤½¦¡
  23. End With
  24. .Save
  25. End With
  26. Application.DisplayAlerts = True
  27. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# stillfish00

±z¦n,

²Ä2¦¸ªº­×§ï¤w¸g¥i¥H±N¥t¦sªº ©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.xlsxÀɮפº®e§ï¬°­È,¦ý¥¦¨ÌµLªk§¹¥þ¹³ "§¹¦¨«áªº³øªí.zip" ¦P®æ¦¡(¥]§t®Ø½u),¦]¬°³o³¡¥÷µLªk¥Î¿ý»sªº(¦]¬°³øªí¸ê®Æ·|ÅܤÆ),¦pªG¦³¤Hª¾¹D«ç»ò¼g«áÄòªºµ{¦¡ªº¸Ü,¬O§_¥i¥HÀ°À°¦£?

§Ú·QÅý¤p­p§¹¦¨«á ÂI¿ï¤p­p2        .Outline.ShowLevels RowLevels:=2, ±N¥i¨£Àx¦s®æ¹º¬õ¦â²Ê®Ø½u(¸Ô¨£: "§¹¦¨«áªº³øªí.zip" )

TOP

  1. Sub paper2()
  2.     With Workbooks(ThisWorkbook.Sheets("VBA").[A2].Value).Sheets("³øªí")
  3.         .UsedRange.Value = .UsedRange.Value    '§ï¬°­È
  4.         .Range("A:C").Delete Shift:=xlToLeft   '§R°£A:C
  5.         
  6.         '¤p­p
  7.         .[A2].Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(7, 8), _
  8.                 Replace:=True, PageBreaks:=False, SummaryBelowData:=True
  9.         .[A:A].Delete Shift:=xlToLeft       '¤p­p«á§R°£AÄæ
  10.         .Outline.ShowLevels RowLevels:=2    '¤p­p«á¿ï#2
  11.         .SaveAs "D:\©â¤ô¾÷¼Æ¾Ú¤ÀªR³øªí\©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.xlsx"  'Àx¦sÀÉ®×
  12.         .Parent.Close False
  13.     End With
  14.    
  15.     'Ãö³¬³øªíµ{¦¡
  16.     ThisWorkbook.Close False
  17. End Sub
½Æ»s¥N½X
¦^´_ 3# PJChen

TOP

¦^´_ 2# stillfish00

±z¦n,

¥¨¶°Áö¥i°õ¦æ,¦ý¦³¥H¤U¤£²Å,½Ð¦AÀ°¦£¬d¬Ý.
1.  ­ìa.xlsxªº³øªí.sheet¬°¤@­Ó®æ¦¡¤w³]©w¦nªº³øªí,§Æ±æ¥i¥H±N­ìÀÉcopy¦¨·sªº,¸û¤è«K§@·~.
2.  ·sªºÀÉ  ©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.xlsx,µLªk±N¤½¦¡Åܦ¨­È,§Ú´ú¸Õ¤F¤U,ÁÙ¬O¦³¤½¦¡. ¦p: ©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.zip      ©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.zip (9.21 KB)
3.  §Ú·Q­n§¹¦¨«áªºÀɮצp: §¹¦¨«áªº³øªí.zip       §¹¦¨«áªº³øªí.zip (9.9 KB)

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-4-26 20:52 ½s¿è

6¤£¤ÓÀ´ , §A¸Õ¬Ý¬ÝÁÙ¦³¤°»ò°ÝÃD
  1. Sub paper2()
  2.     Workbooks(ThisWorkbook.Sheets("VBA").[A2].Value).Sheets("³øªí").Range("D:K").Copy   '½Æ»sDÄæ¨ìKÄæ
  3.    
  4.     With Workbooks.Add  '·s¼W¤@ªÅ¥Õ¬¡­¶Ã¯
  5.         With .Sheets(1)
  6.             .Name = "³øªí"
  7.             .[A1].PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False  '¶K¤W­È
  8.             .[A1].PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone, SkipBlanks:=False, Transpose:=False  '¶K¤W¨Ó·½®æ¦¡
  9.             
  10.             '¤p­p
  11.             .[A2].Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(7, 8), _
  12.                     Replace:=True, PageBreaks:=False, SummaryBelowData:=True
  13.             
  14.             .[A:A].Delete Shift:=xlToLeft       '¤p­p«á§R°£AÄæ
  15.             .Outline.ShowLevels RowLevels:=2    '¤p­p«á¿ï#2
  16.         End With
  17.         .SaveAs "D:\©â¤ô¾÷¼Æ¾Ú¤ÀªR³øªí\©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.xlsx"  'Àx¦sÀÉ®×
  18.         .Close
  19.     End With
  20.    
  21.     'Ãö³¬ÀÉ®×
  22.     Workbooks(ThisWorkbook.Sheets("VBA").[A2].Value).Close False
  23.     ThisWorkbook.Close False
  24. End Sub
½Æ»s¥N½X
¦^´_ 1# PJChen

TOP

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD