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

[µo°Ý] ¥Î¤Gºû°}¦C¡AÂण¥X¨Ó¸ê®Æ

[µo°Ý] ¥Î¤Gºû°}¦C¡AÂण¥X¨Ó¸ê®Æ

¥»©«³Ì«á¥Ñ jesscc ©ó 2011-6-5 23:08 ½s¿è

¤W¦¸©Ó»X«e½ú±Ð¤F§Ú¥Î¤Gºû°}¦CÂà¦hÄæ¦ìªº¸ê®Æ¡A³Ìªñ¸Õ§@¤F¤@­ÓÀɮסA¥i¬O¸ê®ÆÂण¥X¨Ó¡A¤£ª¾­þ¸Ì¥X¤F°ÝÃD¡A¯à½Ð¦U¦ì«e½úÀ°¦£¬Ý¤@¤U¶Ü?

§Úªº¤u§@¬O³o¼Ëªº:
1.¦b Test.xlsm ¤¤ªº Sheets("AA") «ö¤U«ö¶s"POR"¡A·|¦Û°ÊÂà¦s¦¨¤@¥÷ "¤é´Á"+"¤w¥X³f.xlsx" ÀÉ¡A®æ¦¡¸ò­ì¨Óªº Test.xlsm ¬O¤@¼Ò¤@¼Ëªº¡A¦ý¨S¦³¥ô¦ó¸ê®Æ¡C
2.±µµÛµ{¦¡·|§â Test.xlsm ¤¤ AA¡BBB¡BCC ¤T­Ó¤u§@­¶ªº B Äæ¦ì¤¤¥u­n¦³ "v" ¤Î "*" ªº¨º¤@¦C¸ê®Æ¤À§O¦s¤JªÅ¥Õªº "¤é´Á"+"¤w¥X³f.xlsx" ÀÉ

Test.rar (59.69 KB)
Jess

¦^´_ 1# jesscc
  1. Sub ContainerDetails()
  2. Set swb = ThisWorkbook
  3.    mypath = "C:\Documents and Settings\Administrator\®à­±\"
  4.    myfile = Format(Date, "emmdd") & "¤w¥X³f.xlsx"
  5.    swb.Sheets(Array("AA", "BB", "CC")).Copy
  6.    Set wb = ActiveWorkbook
  7.    wb.Sheets("AA").Shapes.Range(Array("CommandButton6")).Delete
  8.    wb.Sheets("AA").Range("B7:J500").ClearContents
  9.    wb.Sheets("BB").Range("B7:J500").ClearContents
  10.    wb.Sheets("CC").Range("B7:J500").ClearContents

  11. For Each Sh In swb.Sheets(Array("AA", "BB", "CC"))
  12. Dim Ay()
  13. With Sh
  14. For i = 7 To .Cells(.Rows.Count, 2).End(xlUp).Row
  15.       If .Range("B" & i) = "v" Or .Range("B" & i) = "*" Then
  16.       ReDim Preserve Ay(s)
  17.       Ay(s) = .Range("B" & i).Resize(, 10).Value
  18.       s = s + 1
  19.       End If
  20. Next
  21. wb.Sheets(.Name).[B7].Resize(s, 10) = Application.Transpose(Application.Transpose(Ay))
  22. Erase Ay
  23. s = 0
  24. End With
  25. Next
  26. wb.SaveAs mypath & myfile
  27. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦n¹³¤£»Ý­n¥Î¨ì¤Gºû°}¦C¡A¬O§Ú·Q¤Ó¦h¤F¡C

¤£¹L¡AHsieh¤j¤j¡A­è­è¸Õ¤F¤@¤Uµo²{¡A¦pªG¦bBÄæ¦ì³£¨S¦³¼Ð°O "v" ©Î "*" ªº±¡§Î¤U¡A¨S¿ìªk¥t¦s¥X¥¿½Tªº¬¡­¶Ã¯ÀɦW(§Úªº·Qªk¬O¡A¦Ü¤Ö¥¦À³¸Ó·|¦s¦¨¤@­ÓªÅ¥ÕµL¸ê®Æªº·s¬¡­¶Ã¯)¡A¦Ó¥B·|¦b³o¤@¦æ¥X²{°»¿ù
wb.Sheets(.Name).[B7].Resize(s, 10) = Application.Transpose(Application.Transpose(Ay))
Jess

TOP

¦^´_ 3# jesscc


   if s>0 then  wb.Sheets(.Name).[B7].Resize(s, 10) = Application.Transpose(Application.Transpose(Ay))
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

­ì¨Ó¥u­nÀˬd°}¦C¤¤¦³µL¦s¤J¸ê®Æ§Y¥i¡C
·PÁ Hsieh ¤j¦A¤@¦¸ªºÀ°¦£¡A¯¬ºÖ§AºÝ¤È¸`´r§Ö!
Jess

TOP

        ÀR«ä¦Û¦b : ¥Í®ð¡A´N¬O®³§O¤Hªº¹L¿ù¨ÓÃg»@¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD