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

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

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

¦³¨Ç¨BÆJµLªk¥Î¿ý»s¤è¦¡,½Ð¤j¤j­ÌÀ°¦£!!
»Ý­n°õ¦æ¥¨¶°ªº³øªí¥i¯à¦³¼Æ­Ó,©Ò¥H§Ú§Æ±æ±NÀɮצWºÙª½±µ¼Ð¥Ü¦bA2.

¥¨¶°°õ¦æªº¨BÆJ¬°:
1- a.xlsx¤w¨Æ¥ý¶}±Ò,copy(·s¼W) ³øªí.sheet«á,±N¥¦Åܦ¨¨S¦³¥ô¦ó¤½¦¡,¦sÀɬ°:©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.xlsx,(¬°¤F¤W¶ÇÀɮפ£­n¤Ó¤j,©Ò¥H¨Æ¥ý±Na.xlsxÅܦ¨¥u¦³­È)
2- Ãö³¬­ìa.xlsx¨Ã¥B¤£­n¦sÀÉ.
3- §R°£ ©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È  A:C (¹B§@¦¸¼Æ(¥þ) /1±Ò°Ê /2±Ò°Ê )
2- ¥H"³sÄò¤é´Á "°õ¦æ¤À²Õ¤p­p",¥[Á`ªºÄæ¦ì¬O"¥Î¹q«×¼Æ" and "¨Ï¥Î®É¶¡(¤À)".
3- §R°£AÄæ:³sÄò¤é´Á
4- ÂI¿ï¤p­p¿ï¶µ2    ActiveSheet.Outline.ShowLevels RowLevels:=2 '¤p­p«á¿ï#2
5- §Æ±æ§¹¦¨«áªº³øªí,§Ú¥t©ñ¦b"§¹¦¨«áªº³øªí.sheet"¤¤.
6. ³øªí.sheetªº¸ê®Æ¨C¦¸³£¤£¬Û¦P,·íµM¦³¥i¯à¼W¥[µ§¼Æ,¥Î¿ý»sªºµLªk¦]À³¨C¦¸¤£¦Pµ§¼Æªº§@·~.

©â¤ô¾÷¼Æ¾Ú¤ÀªR³øªí.zip (30.09 KB)

¦^´_ 15# Hsieh

·PÁ¤j¤H,°õ¦æµL»~!!

TOP

¦^´_ 14# PJChen
µ{¦¡½X³£¦³µù¸Ñ¡A½Ð¤F¸Ñµ{¦¡½X´N¯à¦Û¦æ§ó§ï
  1. Sub Ex()
  2. Dim A As Range
  3. fs = ThisWorkbook.Sheets("VBA").[A2] 'A2¬°ÀɦW
  4. With Workbooks(fs)
  5. .Sheets("³øªí").UsedRange = .Sheets("³øªí").UsedRange.Value
  6. .Sheets("³øªí").Copy '§â³øªí½Æ»s¨ì·sÀÉ®×
  7. .Close 0 'Ãö³¬a.xlsx
  8. End With
  9. Application.DisplayAlerts = False 'Ãö³¬¹ï¸Ü¤è¶ô
  10. ActiveWorkbook.SaveAs "D:\©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.xlsx" '±N·sÀÉÀx¦s
  11. With Workbooks("©â¤ô¾÷¼Æ¾Ú¤ÀªR_­È.xlsx") '³øªí·sÀÉ®×
  12. With .Sheets("³øªí")
  13. .UsedRange = .UsedRange.Value '¥h°£¤½¦¡
  14. .Range("A1").CurrentRegion.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=Array(10, 11), _
  15.         Replace:=True, PageBreaks:=False, SummaryBelowData:=True '¤w³sÄò¤é´Á¤À²Õ¤p­p
  16. .[A:D].Delete '§R°£A:DÄæ¦ì
  17. If .[B3] = "" Then .Rows(3).Delete
  18. With .Range("F:F").SpecialCells(xlCellTypeFormulas)
  19. .Offset(, -1) = "­p"
  20. For Each A In .Cells 'µe®Ø½u
  21. A = Round(A, 3) '¥|±Ë¤­¤J¤p¼ÆÂI3¦ì
  22. A.Offset(, 1) = Round(A.Offset(, 1), 3) '¥|±Ë¤­¤J¤p¼ÆÂI3¦ì
  23.    For i = 7 To 10
  24.        A.Offset(, -1).Resize(, 3).Borders(i).Weight = xlThick '®Ø½u¼e«×
  25.        A.Offset(, -1).Resize(, 3).Borders(i).ColorIndex = 3 '®Ø½uÃC¦â
  26.    Next
  27. Next
  28. End With
  29. For i = 1 To .Cells(.Rows.Count, "E").End(xlUp).CurrentRegion.Rows.Count 'Á`­pªí®æµe®Ø½u
  30.     For j = 7 To 10
  31.        With .Cells(.Rows.Count, "E").End(xlUp).CurrentRegion.Rows(i).Borders(j)
  32.           .Weight = xlThick
  33.           .ColorIndex = 3
  34.         End With
  35.     Next
  36. Next
  37. End With
  38. .Save
  39. End With
  40. Application.DisplayAlerts = True
  41. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 11# Hsieh

¤j¤j,
³Ò·Ð±zÀ°¦£§ï­Ó¤p¦a¤è,¦b³Ì«áÄæ¦ìªº¤p­p¤ÎÁ`­p·|¥X²{¶Â½u,¥i§_§ï¦¨¥H¤Uªº¼Ë¦¡? ÁÂÁÂ!!
³Ì«áªº¤p­p.jpg

TOP

¦^´_ 11# Hsieh

¤j¤j,
³Â·Ð±z«Ü¦h,¤£­n¦A§ï¤F.
§Ú·Q§ï¬°¥|±Ë¤­¤J¤p¼Æ²Ä¤T¦ì,³o¼Ë´N¤£·|¦³¤£²Åªº±¡§Î¤F.

TOP

¦^´_ 11# Hsieh

¤j¤j,
§Ú´ú¸Õ«áµo²{ ¥|±Ë¤­¤J«á ¤p­p»PÁ`­p·|¦³¤p¼Æ®t,¤£ª¾­n¦p¦ó¸Ñ¨M?

TOP

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

TOP

¦^´_ 8# Hsieh

¤£¦n·N«ä,°£¤F«e­±¤G¶µ,¤Sµo²{¥t¤@­Ó°ÝÃD.
3) ­ì¨Óªº³øªí.sheet¬O¦³¤½¦¡¤Î³sµ²ªº,¬°¤F¤è«K¤W¶Ç,©Ò¥H¤½¦¡®t¤£¦h³£¥h°£¤F,¦b¦sÀÉ«e­n¥ý§â¤½¦¡Åܦ¨­È(§_«h¥þ³£¿ù»~­È),¬O§_¥[¦b³o¥y¤§«á?
¥i¬O¥¦»¡¬O"¿ù»~ªº¤Þ¥Î",§Ú§ï«ç»ò§ï?
  1. Workbooks(fs).Sheets("³øªí").Copy '§â³øªí½Æ»s¨ì·sÀÉ®×
  2. .UsedRange = .UsedRange.Value '¥h°£¤½¦¡
½Æ»s¥N½X

TOP

¦^´_ 8# Hsieh

¤j¤j,
1)  ¶]¨ì³o¦æ´N¤¤¤î¤F,¦]¬°A2ªºÀx¦s®æ¥i¥H¥Î¥ô·NÀɦW,ÀɦW¤£¬O"a.xlsx"®É,¥¦´NµLªkÄ~Äò¤F,§ï¦¨¥H¤U½Ð°Ý®t§O¦b­þ¨à?
Workbooks("a.xlsx").Close 0 'Ãö³¬a.xlsx....§ï¬°Workbooks(fs).Close 0 'Ãö³¬a.xlsx  >>ok
                                                                            ....§ï¬°Workbooks("fs").Close 0 'Ãö³¬a.xlsx  >>¤£¦æ
2) ­Y¤p­p&Á`­p Äæ¦ì,§ï¬°¤p¼Æ«á2¦ì¥|±Ë¤­¤J,½Ð°Ý­n¦b­þ¦æ§ó§ï?¥[¤W¤°»òµ{¦¡?

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2013-5-1 00:23 ½s¿è

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

TOP

        ÀR«ä¦Û¦b : «Î¼e¤£¦p¤ß¼e¡C
ªð¦^¦Cªí ¤W¤@¥DÃD