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

"Vlookup" and "Match" in VBA

"Vlookup" and "Match" in VBA

§Ú¥­±`³£·|¥Î«Ü¦h"Vlookup" ¸ò "Match",¦pªG§Ú·Q¥ÎVBAªº¤è¦¡¼g¥X¨Ó,¸Ó«ç»ò°µ©O?
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

http://forum.twbts.com/viewthrea ... p;extra=&page=1
³o¸Ì¦³¦bvba¤¤¤Þ¥Î¤u§@ªí¨ç¼Æªº¹ê¨Ò

TOP

ÁÂÁ¦^ÂÐ,¥i±¤§ÚÅv­­¤£°÷,¤£¯à¤U¸ü,¥i¥H²³æªº¤¶²Ð¤@¤U¶Ü?
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¤èªk1¡G¥Îapplication.¤Þ¥Î¤½¦¡
¤èªk2.¥Îevaluate+¤½¦¡
¤èªk3.¥Î¤¤¨í¸¹§â¤½¦¡®Ø°_¨Ó

TOP

ÁÂÁÂ,§Ú¸Õ¤F...
x = Range("D" & z).Application.Formula = " [=MATCH(Sheets1!""ItemName"",Sheets2!A:A,0)]"
´N¬O¤£¦æ,¥i¥H§i¶D§Ú,§Ú¿ù¦b­þ¸Ì¶Ü?
ÁÂÁÂ~~!
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

Range("d" & z) = Evaluate("MATCH(""ItemNam"",Sheet2!A:A,0)")

TOP

¤W­z¦C¥Xªº¤èªk§A¥u¯à¿ï¤@¼Ë
¤£¯à¨C¼Ë¦P®É¥Î¡AÁÙ¥[¤W¿ý»sªº¥N½X
«e­±"x="¤]¤£¯à¥[¦b¸Ì­±¡A­þ¯à³o»ò¦hµ¥¸¹¡H

TOP

¥»©«³Ì«á¥Ñ am0251 ©ó 2011-6-22 17:13 ½s¿è

«Ü©_©Ç,§Ú¸Õ¹L:
ItemNam = Range("A" & z).Value
x = Application.WorksheetFunction.Match(""ItemNam"",, Sheets("OUT").Range("A:A"))
¬O¤£¦æªº,¥u¦³¤£¥ÎÅܼÆ"ItemNam"¦Óª½±µ§â"Range("A" & z).Value"¥´¶i¥h¤~¯à¥Î Book1.rar (12.98 KB)
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

ÅܼƦ³Åܼƪº¥Îªk¡A¸ò¦r²Å¬O¤£¦Pªºªí¥Ü¡C
ÅܼƤ£¥ÎÂù¤Þ¸¹¡C

TOP

¶â¡A¤W¶ÇÀÉ®×´N¦n¿ì¤F¡I
§ï³o¼Ë
  1. Sub test()

  2. Dim x As Integer
  3. Dim y As Integer
  4. Dim z As Integer
  5. Dim ItemName As String

  6. z = 2

  7. Do While Range("A" & z).Value <> ""

  8. ItemNam = Worksheets("Sheet1").Range("A" & z).Value

  9. x = Application.Match(ItemNam, Sheet2.[A1:A100], 0)

  10. Debug.Print x

  11. z = z + 1

  12. Loop

  13. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : §Ñ¥\¤£§Ñ¹L¡A§Ñ«è¤£§Ñ®¦¡C
ªð¦^¦Cªí ¤W¤@¥DÃD