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

¤u§@ªí¥t¦s·sÀÉ©M¥HÀx¦s®æ¤º®e©R¦W

¦^´_ 2# Andy2483

±z¦n, ¦A·Q½Ð±Ð¦p¦ó¦b§A³oCODE¤º, ±N¥t¦s·sÀɪº½d³ò , «ü©w¦bA1 ¦ÜE30 ?? ¦]¬°§AªºCODE«Ü²`, ¦b¤@¯ëºô­¶³£Ãø§ä¨ì§@½s¿è:Q

ÁÂÁÂ!

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-12-13 16:21 ½s¿è

¦^´_ 11# missbb


    ÁÂÁ«e½ú¦A¦^´_,¤@°_¾Ç²ß
«á¾ÇÂǦ¹©«°µ½Æ²ß¤ß±o»P²K¥[·s»Ý¨D,¾Ç²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò
ªí®æ1:


Option Explicit
Sub TEST()
Application.ScreenUpdating = False
'¡ô¥O¿Ã¹õ¼È¤£ÀHµ{§ÇÅܤƵ²ªG
'Application.DisplayAlerts = False
'¡ô¥Oµ{§Ç¤£¸õ¥X ÀÉ®×­n¤£­nÂл\ ªº¸ß°Ýµ¡,ª½±µÂл\Àx¦s

Dim A, Z, i&, T$, T1$, T2$, F1 As Range, F2 As Range
'¡ô«Å§iÅܼÆ
Set Z = CreateObject("Scripting.Dictionary")
'¡ô¥OZÅܼƬO ¦r¨å
T1 = "¥t¦sÀɮ׸ô®|": T2 = "¥t¦sÀɮצWºÙ"
'¡ô¥OT1,T2ÅܼƬOGJ; Âù¤Þ¸¹¤§¶¡ªº¦r¦ê
For i = 1 To Worksheets.Count
'¡ô³]¶¶°j°é!¥Oi±q1¨ì ¦¹¬¡­¶Ã¯¤u§@ªí¼Æ¶q
   Set F1 = Sheets(i).[1:1].Find(T1, Lookat:=xlWhole)
   '¡ô¥OF1ÅܼƬO ±q²Ä1¦C´M§ä ¨ä¤º®e»P "¥t¦sÀɮ׸ô®|" §¹¥þ¤@¼ËªºÀx¦s®æ
   Set F2 = Sheets(i).[2:2].Find(T2, Lookat:=xlWhole)
   '¡ô¥OF2ÅܼƬO ±q²Ä2¦C´M§ä ¨ä¤º®e»P "¥t¦sÀɮצWºÙ" §¹¥þ¤@¼ËªºÀx¦s®æ
   If F1 Is Nothing Or F2 Is Nothing Then GoTo i01 Else T = F2(1, 2) & "/S"
   '¡ô¦pªGF1ÅܼƩΠF2Åܼƨ䤤¤@­Ó§ä¤£¨ì!´N¸õ¨ì¼Ð¥Ü i01ªº¦ì¸mÄ~Äò°õ¦æ,
   '§_«h´N¥OTÅܼƬOF2ÅܼƦP¤@¦C¥kÃä®æªº¤º®e³s±µ "/S"©Ò²Õ¦¨ªº·s¦r¦ê

   If Z(T) <> "" Then MsgBox F2(1, 2) & " ÀɦW­«½Æ,½ÐÀˬd": Exit Sub
   '¡ô¦pªG¥HTÅܼƬdZ¦r¨å ¦^¶Çitem­È¤£¬OªÅªº!¥NªíÀɮצWºÙ­«½Æ¤F,¸õ¥X´£¥Ü,µ²§ôµ{¦¡°õ¦æ
   Z(T) = F1(1, 2) & "": Set Z(F2(1, 2) & "") = Sheets(i): Z(F2(1, 2) & "/a") = F1.Address
   '¡ô¥OTÅܼƬ°key,item¬O F1ÅܼƦP¤@¦C¥kÃä®æªº¦r¦ê¤º®e,¯Ç¤JZ¦r¨å¤¤
   '¥OF2ÅܼƦP¤@¦C¥kÃä®æªº¦r¦ê¤º®e¬°key,item¬O°j°é¼Æ©Ò¤Þ¸¹¤u§@ªí
   '¥OF2ÅܼƦP¤@¦C¥kÃä®æªº¤º®e³s±µ "/a"©Ò²Õ¦¨ªº¦r¦ê¬°key,item¬O F1ÅܼƪºÀx¦s®æ¦ì§}

i01: Next
For Each A In Z.KEYS
'¡ô³]³v¶µ°j°é!¥OAÅܼƬOZ¦r¨åªºkey¤§¤@
   If Not IsObject(Z(A)) Then GoTo A01 Else T = Z(A & "/S")
   '¡ô¦pªG¥HAÅܼƬdZ¦r¨å¦^¶Çitem¤£¬Oª«¥ó!´N¸õ¨ì¼Ð¥Ü A01¦ì¸mÄ~Äò°õ¦æ,
   '§_«h´N¥OTÅܼƬO ¥HAÅܼƳs±µ "/S"©Ò²Õ¦¨ªº¦r¦ê¬dZ¦r¨å¦^¶Ç­È

   Z(A).Copy: If Dir(T, vbDirectory) = "" Then MkDir T
   '¡ô¥OAÅܼƬdZ¦r¨å¦^¶Ç­È(ª«¥ó:¤u§@ªí) ½Æ»s¤@¥÷¨ì·s¬¡­¶Ã¯
   '¦pªGTÅܼƪº¸ê®Æ§¨¤£¦s¦b!´N«Ø¥ßT(¦r¦ê)Åܼƪº¸ê®Æ§¨

   With ActiveSheet.UsedRange: .Value = .Value: End With
   '¡ô¥O¦¹·s¬¡­¶Ã¯¸Ìªº¸Ó·s¤u§@ªí³£­pºâ¦¨­È(¤½¦¡Åܦ¨­È)
   Range(Z(A & "/a")).Resize(2, 2) = ""
   '¡ô¥OÀɮ׸ô®|»PÀɮצWºÙ4®æÅܦ¨ªÅ®æ
   
   '±N¥t¦s·sÀɪº½d³ò , «ü©w¦bA1 ¦ÜE30 ??
   '¦]¬°»Ý¨D¬O­n«O¯d­ì¨Ó®æ¦¡,©Ò¥H¥H½Æ»s¤u§@ªí¨ì·s¬¡­¶Ã¯,¦A§R°£¤£­nªº½d³ò§Y¥i
   ActiveSheet.UsedRange.Offset([A1:E30].Rows.Count, 0).EntireRow.Delete
   '¡ô¥O«ü©w«O¯dªº½d³ò¥H¤Uªº¦C §R°£
   ActiveSheet.UsedRange.Offset(0, [A1:E30].Columns.Count).EntireColumn.Delete
   '¡ô¥O«ü©w«O¯dªº½d³ò¥k°¼Äæ §R°£
   
   With ActiveWorkbook: .SaveAs Filename:=T & "\" & A: .Close: End With
   '¡ô¥O¦¹·s¬¡­¶Ã¯Àx¦s¨ì«ü©w¸ô®|ªºÀɦW,¤§«áÃö³¬¦¹·s¬¡­¶Ã¯
   ThisWorkbook.Activate
   '¡ô¥Oµ{§Ç¦^¨ì¥»ÀÉ
A01: Next
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 12# Andy2483

«D±`·PÁÂ¥[¤J¸ÑÄÀ¡A µL¨p«ü¾É:'(

TOP

¦^´_ 10# singo1232001
¦hÁ«ü¾É¡I:D

TOP

        ÀR«ä¦Û¦b : ¤H­n¦Û·R¡A¤~¯à·R´¶¤Ñ¤Uªº¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD