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

[µo°Ý] ¦p¦ó¦bmatch¤¤¤Þ¥Î2ºû°}¦C

[µo°Ý] ¦p¦ó¦bmatch¤¤¤Þ¥Î2ºû°}¦C

¥»©«³Ì«á¥Ñ yen956 ©ó 2015-12-6 13:16 ½s¿è

¤U¦CVBA¤¤,¦³¤@¬qmatch¶·¤Þ¥Î1ºû°}¦C,
¬G¥ý±N2ºû°}¦C¥ýÂন1ºû°}¦C¦A¤Þ¥Î(¬õ¦â³¡¤À),
½Ð°Ý¬õ¦â³¡¤À¦p¦ó¥¿½T¤Þ¥Î(¦p¦óºë²)?
  1. Public arW, arL
  2. '¨ú±o寛«×»Pªø«×¬É­­ªº°}¦C, ¨ÑMatch¥Î
  3. Sub init()
  4.     ReDim arW(3) As Integer
  5.     ReDim arL(3, 3) As Integer
  6.     Dim W1 As Integer, L1 As Integer
  7.     arW(0) = Split(Cells(3, 3), "~")(1)    '寛«×ªº¤W­­
  8.     For W1 = 0 To 2
  9.         arW(W1 + 1) = Split(Cells(W1 * 3 + 3, 3), "~")(0) '寛«×«ö­°¾­±Æ
  10.         For L1 = 0 To 2
  11.             arL(W1, L1) = Split(Cells(W1 * 3 + L1 + 3, 5), "~")(0)   'ªø«×«ö¤É¾­±Æ
  12.         Next
  13.         arL(W1, L1) = Split(Cells(W1 * 3 + L1 + 2, 5), "~")(1)     'ªø«×ªº¤W­­
  14.     Next
  15. End Sub

  16. Private Sub CommandButton1_Click()
  17.     Dim I As Integer, J As Integer, arL2(3) As Integer
  18.     Dim MHW, MHL, IDW As String, IDL As String
  19.     init
  20.     For I = 4 To [G4].End(xlDown).Row
  21.         MHW = Application.Match(Cells(I, 8), arW, -1)
  22.         IDW = Application.Index([B1:B11], MHW * 3, 1)
  23. [color=Red]        For J = 0 To 3
  24.             arL2(J) = arL(MHW - 1, J)    '±N2ºû°}¦CÂର1ºû°}¦C
  25.         Next
  26.         MHL = Application.Match(Cells(I, 9), arL2, 1)[/color]
  27.         'ªø«×¥N¸¹¤À[D3:D5,D6:D9,D10:D12]¤T°Ï
  28.         IDL = Application.Index([D3:D5,D6:D8,D9:D11], MHL, 1, MHW)
  29.         Cells(I, 10) = IDW & "_" & IDL
  30.     Next
  31. End Sub
½Æ»s¥N½X
(µù:VBA¥i¥¿±`¹B§@)
       For J = 0 To 3
            arL2(J) = arL(MHW - 1, J)    '±N2ºû°}¦CÂର1ºû°}¦C
        Next
        MHL = Application.Match(Cells(I, 9), arL2, 1)

¦h±ø¥ó§PÂ_½s»s¦WºÙ1206.rar (11.7 KB)

¦^´_ 7# c_c_lai
c¤j§A¦n:
­ã¤jªºfunction¥»¨Ó´N¬Û·í¤£¿ù,
§Úªº¥DÃD:¦p¦ó±N2ºû°}¦C¤Æ¬°1ºû°}¦C¨Ñ Match ¥Î,
¤w¦b6#±o¨ìstillfish00¤j¤jªº«ü¾É,
ÁÂÁÂc¤j¤@¦A«ü¾É, ÁÂÁÂ!!

TOP

¦^´_ 6# stillfish00
ÁÂÁÂstillfish00¤j¤j:
­ì¨Ó¥Î array + index´N¥i¥H¤Æ2ºû°}¦C¬°1ºû°}¦C,
¤£¥²¥ÎFor ...nextÂà´«, ¯u¬O¤Ó¦n¤F, ÁÂÁÂ!!

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2015-12-8 14:59 ½s¿è

¦^´_ 15# ­ã´£³¡ªL
Æ[¹î«e«áÀɮצsÀɫᤧªº Icon Åã¥Ü¡G
F.png
±z´£¤Îªºª¬ªp¤]·¥¦³¥i¯à¡AÁÂÁ±z¡I

TOP

¦^´_ 14# c_c_lai


¬O§_¥i¯à get_wl ¤w¥Î¦b¡e©w¸q¦WºÙ¡f¡A¤~·|²£¥Í¡­REF¡ã¡ã

TOP

¦^´_ 13# ­ã´£³¡ªL
²×©ó°ÝÃD¸Ñ¨M¤F¡A­è­è­«·s±q#1¤U¸ü
«Kª½±µ°µµ²ªG OK¤F¡A¦A¦^¨ì­ì¥ý¦³°ÝÃDªº¥ý«e
°ÝÃDÀɮסA«ç»ò°µ«ç»ò¿ù¡A·¥¦³¥i¯à¨º¤äÀÉ®×
¸Ì¦³¼ç¦b°ÝÃD¡A¤£ºÞ¥¦¤F¡I
ÁÂÁ±z­@¤ß¦a¦^ÂСA¦A¦¸ÁÂÁ¡I

TOP

¦^´_ 12# c_c_lai


=get_wl(B$3:E$11,H4,J4) ¡@¡Ö¡@=get_wl(B$3:E$11,H4,I4)

²Ä¤T­Ó°Ñ¼Æ¦b¢ñÄæ¡A
¤£¹L´Nºâ¥ÎJ4¡A¤½¦¡µ²ªG¬°ªÅ¥Õ¡]¦]µL²Å¦X°Ï¶¡­È¡^¡A¤]¤£·|¦³#REF©Î#Value¿ù»~¡A
·|¤£·|¬Oª©¥»°ÝÃD¡H¡]§Ú¬O2000)

TOP

¦^´_ 11# ­ã´£³¡ªL
¯à§_À°§ÚÀˬd¬Ý¬Ý¡A¨ì©³®t²§©Ê¦b­þ¸Ì¡H
ÁÂÁ±z¡I
¦h±ø¥ó§PÂ_½s»s¦WºÙ1206_v0.rar (15.5 KB)

TOP

¦^´_ 10# c_c_lai


°Ñ¦ÒÀÉ¡G
¦h±ø¥ó§PÂ_½s»s¦WºÙ1206_v01.rar (9.08 KB)

­YÁÙ¦³°ÝÃD¡A¥i±NÀɮפW¶Ç¡I¡I

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2015-12-8 13:21 ½s¿è

¦^´_ 9# ­ã´£³¡ªL
ÁÂÁ±z¦^ÂСA§Ú¨Ï¥Î±z#3¼Óªºµ{¦¡
´úªº¤â³£³n¤F¡AÁÙ¬O¤@¼Ë (µL½×¬O¦b¥ô¦óÄæ¦ì¡A¥]§tJ4)
¨ÌµM¬O #REF!¡C¬Æ¦Ü¼g¤F¨â¤ä´ú¸Õµ{¦¡¡A³£ PASS¡G
  1. Function AddCol(h, i) As String
  2.     AddCol = h + i
  3. End Function

  4. Function AddCol2(w, h, i) As String  '  ¬G·N±a¤J w °Ñ¼Æ
  5.     AddCol2 = h + i
  6. End Function
½Æ»s¥N½X

°ß¿W =get_wl(B$3:E$11,H4,J4) ¤£¦æ¡G

°ÝÃDÀ³¸Ó¥X¦bµ{¦¡½X¤º³¡µLªk°Ñ·Ó¨ì B$3:E$11¡A
¦ý¥Î VBA ÀË´ú¤]§ä¤£¥X°ÝÃDÂI¡C

TOP

        ÀR«ä¦Û¦b : ¥ÌÄ@°µ¡BÅw³ß¨ü¡C
ªð¦^¦Cªí ¤W¤@¥DÃD