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

½Ð°ª¤âÀ°¦£¡A¨D§UVBA¥]§t®M¥Î¤Î¹¢¿ïµ¥«ü¥O

½Ð°ª¤âÀ°¦£¡A¨D§UVBA¥]§t®M¥Î¤Î¹¢¿ïµ¥«ü¥O

¥»©«³Ì«á¥Ñ tc1701 ©ó 2016-4-2 01:46 ½s¿è

¤j®a¦n¡A¤p§Ì³Ìªñ¤u§@¤W¦³¤@­Ó¤pÃøÃD¡A´N¬O§â¤T­ÓEXCEL®M¥Î¨ì¤@­ÓEXCEL¤J­±¡A¦A§â¤J­±ªº¸ê®Æ¸g¹L¹¢¿ï«á±o¥Xµ²ªGµ¹¨ä¥L³¡ªù¨Ï¥Î¡C

¥ý²³æ»¡©ú¤@¤U¨BÆJ:

¤p§Ì¦³4­ÓEXCEL FILE ¡A¤À§O¦³  FW¯]Ä_¤W¸¨µP¤@Áä(§tVBA)¡BF¯]Ä_¤W¸¨µP(¸ê®Æ1)¡BW¯]Ä_¤W¸¨µP(¸ê®Æ2)¡BChristy¯]Ä_§ó·s(¸ê®Æ3)

1.­n±NF¯]Ä_¤ÎW¯]Ä_ COPY¨ì VBA EXCEL¤W¡A¤§«á§R°£°£¤F°Ó«~«¬¸¹¤Î¿Ë´£ªºCOLUMN¡C
2.¹¢¿ï·Q§R¥h¤£·Q­nªºª««~¡A§Ú¥u·Q¯d¤UFJ¦rÀY¤ÎW¦rÀYªºROW¡A¨ä¾l§R±¼¡C
3.¥Ñ©óF¤ÎW¯]Ä_¤W¸¨µP ªº½s¸¹¸òChristy¯]Ä_§ó·s¤£¤@¼Ë¡A·N«ä¬O¨Ò¦pF¯]Ä_ªº½s¸¹¬OFJB028000¡AChristy¯]Ä_§ó·sªº½s¸¹¬OFJB028-000¡A
   ©Ò¥H­n§âF¤ÎW¯]Ä_½s¸¹Åܦ¨¸òChristyªº½s¸¹¬Û¦P ( §â½s¸¹¥[¤W"-")¡C ©Ò¥H§Ú·|¦AE2 ¿é¤J =LEFT(C2,6)¡BF2¿é¤J"-"¡BG2¿é¤J=RIGHT(C2,3)¡BH2¿é¤J =E2&F2&G2¡BµM«á®M¥Î¨ì³Ì©³¡C
   µM«á§âCOLUMN H ªº­ÈCOPY¨ì COLUMN C ¡A³Ì¥H§â©Ò¦³½s¸¹¸òChristy¤@¼Ë¤F¡C
4.¤§«á§âChrisyªº¸ê®Æcopy¨ì VBA EXCEL¤W¡CµM«á¦bH2 ¿é¤J =VLOOKUP(C2,F:G,2,FALSE)¡A¦]¬°F¤ÎW½s¸¹¬O¤½¥q¥H¨Ó©Ò¦³ªº½s¸¹¡A¦³¨Ç¤w¸g°±²£¤F¡A¦ýChristy¥u·|½æ²{¦³ªº½s¸¹¡A
    ©Ò¥HF¤ÎW½s¸¹¤@©w¦h¹LChristy½s¸¹¡C

¥Ñ1-4ÂI§Ú³£¦³VBA°µ¦n¤F(·í¤¤¦³«Ü¦h³£«ÜÄê¡A©Ò¥H·Q½Ð°ª¤â­ÌÀ°¦£À°¦£)¡C
²Ä5ÂI¶}©l§Ú´N¤£À´¤F¡C


¥Ñ©ó¿Ë´£(COLUMN D) Åã¥Ü¬O/§_ ¡A·N«ä¬O¦³¤WµP¤Î¨S¦³¤WµPªº·N«ä¡C
¦ýChristy ªº§ó·sªí·|ÅãµM¸Ó³f«~¦³¨S¦³§ó·s¡C
5.°²¦p FJB001-047        §_  ¡AChristy Åã¥Ü#N/A ©ÎªÌ 0 ¡A·N«ä´N¬O¥»¨­¸Ó½s¸¹¨S¦³¤WµP¡A¦Ó¥BChristy ªº§ó·sÅ㤣#N/A ©Î 0 ¡A©Ò¥H§Ú¤£¥Î§â¥L¤WµP¡C
6.°²¦pFJB001-050        ¬O   , Christy Åã¥Ü=>1 ¡A·N«ä¬O¥»¨­¸Ó½s¸¹¦³¤WµP¡A¦Ó¥BChristyªº§ó·sÅã¥Ü=>1 ¡A©Ò¥H§Ú¤£¥Î§â¥L¤UµP¡C

¨ì³o¨à¡A§Ú·Q½Ð°ª¤âÀ°¦£±Ð¤@¤U§Ë­ÓVBA ¤@Áä¸ò§Ú»¡¦³¨S¦³ªF¦è­n¤WµP¡A¦³¨S¦³ªF¦è­n¤UµPªºMESSAGE BOX ¡AMESSAGE BOX ¸ò¨Ï¥ÎªÌ»¡¤°»ò²£«~­n¤WµP¡A¤°»ò²£«~­n¤UµP¡C

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

¦Ü©ó1-4 ÂI¡A
§Ú¦b¹¢¿ï§R°£ ROW®É¡A¬O©T©w§R°£¬Y´X­ÓROW¡A¦]¬°¦pªG¥uÅã¥ÜSJ¡A°²¦p¦³10­Ó¡A²Ä¤@­ÓSJ¤£¬O¥ÑROW 2 ¶}©l¡A¥i¯à¥Ñ²Ä100­Ó¶}©l¡A§Ú´N¤£ª¾¹D«ç¼Ë§â²Ä100­Ó³]¬°¤@­ÓÅܼơA¦ý²Ä10­Ó§Ú´NÀ´«ç¼Ë³]¬°ÅܼơC
©Ò¥H¦pªGF¤ÎW¯]Ä_¦³·sªF¦è¥[¤J®É¡A§Ú¤S­n­×§ï¡C©Ò¥H½Ð°ª¤â­Ì±Ð¤@±Ð«ç¼Ë³]²Ä¤@­ÓSJ¬°ÅܼơC

²Ä2­Ó°ÝÃD¬O¹¢¿ï®É¡A¦]¬°§Ú¬O¿ý¨îªº¡A«ü¥O¥X¤F¤@¥y
  1. ActiveWorkbook.Worksheets("¤u§@ªí1").AutoFilter.Sort.SortFields.Clear
  2.     ActiveWorkbook.Worksheets("¤u§@ªí1").AutoFilter.Sort.SortFields.Add Key:=Range( _
  3.         "C1:C629"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
  4.         xlSortNormal
½Æ»s¥N½X


¦ý§Ú°±¤î¤F«ü¥O¡A¤§«á¦A«ö¤@¦¸¤SÄ~Äò¤F¡C


²Ä3­Ó°ÝÃD¬Oµ²§ô°µ§¹¤F¡A·QÀx¦s®É¡A´N¼u¤W¤F³o­Ó



³o­Ó¤@©w­n¤j¤uµ{¡A¥i¯à¤j®aÄ~Äò§Ú§¤¤U¨ÓÀH«K¥´´X­Ó¤å¦r´N¦³VBA¥Î¡A
¦ý¥Ñ1-4 ÂI¡A§Ú§Ö¥Î¤F3¤Ñ®É¶¡¤F¡A§Ú¹ïVBA¤£¼ô±x¦ý§Ú¯uªº«Ü¥Î¤ß¥h°µ¡A¦ýª¾ÃѤ£¦h¡A©Ò¥H¤~·Q°ª¤â­Ì«ü±Ð¤@¤U¡C
¯uªº§Æ±æ¤j®a¥i¥HÀ°¨ì§Ú¡A¤Q¤À·P¿E¡A©ÎªÌ¥i¥H±Ð¤p§Ì°µ¡C¯uªº¤Q¤À·P¿E¡CÁÂÁÂ!!

·s¼W¸ê®Æ§¨.rar (94.95 KB)

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2016-4-2 11:13 ½s¿è

²Ä¢´ÂI»Ý¨D¤£¤Ó²M·¡¡A¥ý¸Õ¬Ý¬Ý¡G
  1. Sub ¸ü¤J()
  2. Dim Arr, xB As Workbook, BKN, i&, N&, xD, U
  3. Call ²M°£
  4. Set xD = CreateObject("Scripting.Dictionary") '¦r¨åÀÉ
  5. Application.ScreenUpdating = False

  6. Set xB = Workbooks.Open(ThisWorkbook.Path & "\Christy¯]Ä_§ó·s.xls", ReadOnly:=True) '°ßŪ¶}±ÒÀÉ®×
  7. Arr = Range(xB.Sheets(1).[C1], xB.Sheets(1).Cells(Rows.Count, 2).End(xlUp)) '±N¸ê®Æ½d³ò¯Ç¤J°}¦C
  8. xB.Close 0 'Ãö³¬ÀÉ®×
  9. For i = 2 To UBound(Arr)
  10.     If Left(Arr(i, 1), 2) = "FJ" Or Left(Arr(i, 1), 1) = "W" Then 'Àˬd½s¸¹­º2©Î1­^¤å½X
  11.        N = N + 1 '²Å¦XªÌ²Ö¥[1
  12.        Arr(N, 1) = Left(Arr(i, 1), 6) & "-" & Right(Arr(i, 1), 3) '¼g¤J½s¸¹
  13.        Arr(N, 2) = Arr(i, 2) '¼g¤J¼Æ¶q
  14.        xD(Arr(N, 1)) = Arr(N, 2) '¥H½s¸¹¬°key,±N¼Æ¶q¯Ç¤J¦r¨åÀÉ
  15.     End If
  16. Next i
  17. If N > 0 Then Cells(Rows.Count, "H").End(xlUp)(2).Resize(N, 2) = Arr '¸ü¤J°}¦C¤º®e


  18. For Each BKN In Array("F¯]Ä_¤W¸¨µP", "W¯]Ä_¤W¸¨µP") '³v¤@¶}±Ò¨â­ÓÀÉ®×
  19.     Set xB = Workbooks.Open(ThisWorkbook.Path & "\" & BKN & ".xls", ReadOnly:=True) '°ßŪ¶}±ÒÀÉ®×
  20.     Arr = xB.Sheets(1).UsedRange '±N¸ê®Æ½d³ò¯Ç¤J°}¦C
  21.     xB.Close 0 'Ãö³¬ÀÉ®×
  22.     N = 0 '­p¼Æ¾¹Âk0
  23.     For i = 2 To UBound(Arr)
  24.         If Left(Arr(i, 5), 2) = "FJ" Or Left(Arr(i, 5), 1) = "W" Then 'Àˬd½s¸¹­º2©Î1­^¤å½X
  25.            N = N + 1 '²Å¦XªÌ²Ö¥[1
  26.            Arr(N, 1) = Left(Arr(i, 5), 6) & "-" & Right(Arr(i, 5), 3) '¼g¤J½s¸¹
  27.            Arr(N, 2) = Arr(i, 12) '¼g¤J[¬O/§_]
  28.            Arr(N, 3) = Val(xD(Arr(N, 1))) '¼g¤J¼Æ¶q(±q¦r¨åÀɤ¤¨ú¥X)
  29.            '¡õ¤W/¤UµPÀˬd
  30.            Arr(N, 4) = ""
  31.            If Arr(N, 2) = "§_" And Arr(N, 3) > 0 Then Arr(N, 4) = "¡¶¤WµP": U = U + 1
  32.            If Arr(N, 2) = "¬O" And Arr(N, 3) = 0 Then Arr(N, 4) = "¡¿¤UµP": U = U + 1
  33.         End If
  34.     Next i
  35.     If N > 0 Then Cells(Rows.Count, "C").End(xlUp)(2).Resize(N, 4) = Arr '¸ü¤J°}¦C¤º®e
  36. Next

  37. Application.ScreenUpdating = True
  38. If U > 0 Then MsgBox "¦@¦³ " & U & " ­Ó¶µ¥Ø¶·³B²z¡I¡@"
  39. End Sub

  40. Sub ²M°£()
  41. With ActiveSheet
  42.     If .FilterMode Then .ShowAllData
  43.     .UsedRange.Offset(1, 0).EntireRow.Delete
  44.     .[A2].Select
  45. End With
  46. End Sub
½Æ»s¥N½X
¡@
¡@
°Ñ¦ÒÀɮסGXLS®æ¦¡¡A½Ð¦Û¦æ¥h®M
FW¯]Ä_¤W¸¨µP¤@Áä.rar (72.71 KB)
¡@
¥t¤@¸üÂI¡G
http://www.funp.net/918457
¡@
¡@

TOP

¦^´_ 2# ­ã´£³¡ªL



ª©¤j§A¦n¡A³Ìªñ³£¨S®É¶¡¤W½u¡A³o­Óµ{¦¡¯u¬O¯«¡C¦³»¡©ú«D±`¦n,,,
¥i±¤§Ú¤@¥y¤]¤£©ú¥Õ..¤£¬O§ÚÃi..¦Ó¬O¯uªº¤Ó²`¶ø..
ª©¤j¤è«K¦³¤Ñ¥i¥H¸Ô²Ó¸ÑÄÀ¤@¤U¶Ü?
¦]¬°§Ú·Q§Q¥Î³o­Óµ{¦¡½X®M¥Î¨ä¥LEXCEL¥Î©ó¤u§@¤W¡A¦Ó¥B§Ú·Q¤F¸Ñ¤F¡A¦Ó¸ò¦P¨Æ­Ì¸ÑÄÀ¤@¤U¡A¤£·Q¥L­Ì¥u·|«ö¦Ó¤£¥h¾Ç¡C

ªÖ±Ðªº¯uªº·|¤Q¤À·P¿E!!

­ì¨Ó§Ú¤@ª½¦^Âпù©«¤l= ="¨S¦³°¨¤W·PÁ¹ê¦b©êºp!!

TOP

¦^´_ 3# tc1701
¥i±¤§Ú¤@¥y¤]¤£©ú¥Õ..¤£¬O§ÚÃi..¦Ó¬O¯uªº¤Ó²`¶ø..

¤£¬O§AÃi..¤]¤£¬O²`¶ø. ¬O­n¶O®É¶¡¥h¿Ëªñ¥¦,¤~·|»{ÃÑ¥¦,³ßÅw¥¦.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 3# tc1701


¦p¶Wª©©Ò¨¥, ¤@¤Á»Ý­n®É¶¡
--- ¥²¶·¯u¥¿¦³¤ßªá®É¶¡¥h§ä¸ê®Æ, ¶R®Ñ, ¬Ýexcel¤º«Ø»¡©úÀÉ,
ÁÙ¨S¦³vba°ò¥»»{ÃÑ, »¡¤Ó¦h¤]¬O¨S¦h¤j¥Î³B, Ãú¸Ì¬Ýªá,
´N¹³¥~°ê¤H¥¼¾Ç«÷­µ©Îª`­µ, «ÜÃø¸ò¥L¸ÑÄÀ»y¤å, ¨C¤@¥y³£¦p¤å¨¥¤åªºÃøÀ´,
¦³¤F°ò¦, ¨º§Ú©Ò¼gªºµ{¦¡, ¬Ý°_¨Ó´N¬O¥Õ¸Ü¤å, ¤@­Ó»¡©ú³£¤£¥Î!!!

TOP

        ÀR«ä¦Û¦b : ®É®É¦n¤ß´N¬O®É®É¦n¤é¡C
ªð¦^¦Cªí ¤W¤@¥DÃD