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

[µo°Ý] vlookup¦X¦}ªº¸ê®Æ

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-12-30 14:53 ½s¿è

¦^´_ 20# 198188
ÁÂÁ«e½ú¦A¦^´_·s½d¨Ò,¥H¤U¬O¾Ç²ßªº¤è®×,½Ð«e½ú°Ñ¦Ò
Option Explicit
Sub TEST()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim Brr, Crr, Ar, Arr, V, Z, A, i&, R&, C%, j%, T$, K$, Qs$, Qd$, No$, Mk$, Q$
For i = Worksheets.Count To 3 Step -1: Worksheets(i).Delete: Next
Set Z = CreateObject("Scripting.Dictionary")
Brr = Union(Sheets(1).UsedRange, Sheets(1).UsedRange.Offset(1))
Crr = Range(Sheets(2).[A1], Sheets(2).UsedRange): K = [B1]
For i = 1 To UBound(Brr) - 1
   If InStr(Brr(i, 1), Left(K, 4)) = 0 Then GoTo i01
   A = Split(Replace(Brr(i, 1), "  ", " "), " "): Q = Left(A(0), 8): Qd = A(1)
   If UBound(A) > 1 Then Qs = A(UBound(A)) Else Qs = ""
   A = Z(Q): R = Z(Q & "/r"): C = 1
   If Not IsArray(A) Then A = Crr: A(3, 2) = Q: A(3, 6) = Qs: A(3, 9) = Qd: A(4, 13) = Date: R = 5
   R = R + 1: V = A(R, 2)
   If InStr(Brr(i, 2), V) = 0 Or R = 10 Then GoTo i01
   For j = 2 To UBound(Brr, 2)
      C = C + 2: T = Trim(Brr(i, j)): If T = "" Then GoTo j01
      If InStr(T, V) Then
         A(R, C) = Mid(T, 4, 6): A(R, C + 1) = Replace(Mid(T, 11), ")", "")
         Else
         Ar = Split(T, Chr(10))
         For Each Arr In Ar
            If Not Split(Arr & " ", " ")(1) Like "[A-z][A-z]" Then GoTo j01
            No = No & Chr(10) & Split(Arr, " ")(0)
            Mk = Mk & Chr(10) & Mid(Arr, InStr(Arr, Split(Arr, " ")(1)))
         Next
         A(R, C) = Mid(No, 2): A(R, C + 1) = Mid(Mk, 2): No = "": Mk = ""
      End If
j01: Next
   Z(Q) = A: Z(Q & "/r") = R
i01: Brr(i + 1, 1) = IIf(Brr(i + 1, 1) = "", Brr(i, 1), Brr(i + 1, 1))
Next
If Z.Count = 0 Then Exit Sub
For Each A In Z.KEYS
   If Not IsArray(Z(A)) Then GoTo A01
   With Sheets(2).Copy(after:=Worksheets(Sheets.Count))
      ActiveSheet.Name = "Result " & A
      [A1].Resize(UBound(Z(A)), UBound(Z(A), 2)) = Z(A)
   End With
A01: Next
Application.Goto Sheets(1).[A1]
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 21# Andy2483


    §Ú§â¤¤¤åÅܦ¨­^¤å¡A¦ý¬O¹B¦æVBA¨S¦³¤°麽®ÄªG¥X¨Ó¡C¥i¥HÀ°§Ú¬Ý¬Ý­þùؽĶ¿ù¤F¶Ü¡H

SR1.rar (156.94 KB)

TOP

¦^´_ 21# Andy2483


    ²o¯A¨ì¶Ã½X¡A¯à¤£¯à±NSHEET ¦W©R¦W¬°¡§#¡¨¶}©l¥[«á­±¤T­Ó¼Æ¦r¡C
¨Ò¦p
#001
#002
#003

Container Map1 .rar (32.63 KB)

TOP

¦^´_ 23# 198188


    Q = Left(A(0), 8)  ¸m´«¬°   Q = Mid(A(0),5,4)
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 24# Andy2483


     §ï¤F¤§«á¦b³o­Ó¦ì¸m¥d¦í¤F
With Sheets(2).Copy(after:=Worksheets(Sheets.Count))

TOP

¦^´_ 25# 198188


    ¸Õ¹L23#½d¨Ò Q = Mid(A(0),5,4) °õ¦æ¨S°ÝÃDªº
¦A¸Õ¸Õ¬Ý©Î ¦pªG±ø¥ó¤£¤@¼Ë,½Ð¦A¤W¶Ç½d¨Ò
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 26# Andy2483


    §ï¤F¤§«á¡A¦b¨º­Ócopy sheet ªº¦ì¸m¥d¦í¤F­pºâsheet ¬Oªº¦ì¸m

Container Map1 .rar (32.8 KB)

TOP

¦^´_ 27# 198188


    ¤U¸ü¨Ó°õ¦æ¬O¥¿±`ªº,¤£ª¾¹D¤°»ò­ì¦],½Ð¸ô¹Lªº«e½ú­ÌÀ°À°¦£
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 28# Andy2483


    §ÚºI¹Ï¤F¡A§A¬Ý¬Ý¬O¤£¬OTªº¼Æ­È¶Ã½Xªº°ÝÃD¡H

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2024-1-3 09:26 ½s¿è

¦^´_ 29# 198188


    https://answers.microsoft.com/zh ... 6-8cbe-c767e095fade

´«¥x¹q¸£¸Õ¸Õ¬Ý
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ¤ß¤¤±`¦sµ½¸Ñ¡B¥]®e¡B·P«ä¡Bª¾¨¬¡B±¤ºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD