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

VLOOKUPªº°ÝÃD

VLOOKUPªº°ÝÃD

·Q½Ð°Ý¤@¤U¦p¦ó¦b¨Ï¥ÎVBAªºVLOOKUP¡A¦]¬°´ú¸Õ¤F«Ü¦h¦ý¬O§ìªº­È³£¬O¿ù»~¡A¦ý¤S¤£ª¾¹D­þ¸Ì¿ù»~¡A¦³¨S¦³¤H¥i¥HÀ°§Ú¸ÑÄÀ¤@¤U

µ{¦¡½X¦p¤U¡G

Sub V¦¡§ì­È()

Dim x As Integer
Dim y As String
Dim z As String
1
z = 2
y = Worksheets("Sheet1").Range("A" & z).Value
Range("B2").Value = Application.VLookup(y, Sheet2.[A1:B100], 2)



End Sub



³Â·Ð¤F¡I>"<

Book1.rar (12.15 KB)

«Øij§A§O«]­­©ó¦bVBA¤¤¤Þ¥Î¤u§@ªí¨ç¼Æ
®ÄªG¤£¦nÁ٫ܶO¦r
VBA¦³VBA¦Û¤vªº¤èªk
¦¹¨Ò¥ÎFIND¤èªk´N«Ü¾A¦X
¨S¦³¥ª¥kÃ䪺°ÝÃD
°Ñ¦Ò¤@¤U»¡©ú¹Á¸Õ¬Ý¬Ý§a¡I

TOP

«¢¡I­ì¨Ó¦p¦¹¡A§Ú¦³¹Á¸Õ³o¼Ë¼g
if  Application.VLookup(y, Sheet2.[A1:B100], 2, 0))=iserror then
¥i¬O¿ù»~¤@®É¤]¤£ª¾¸Ó«ç»ò³B²z¡A­ì¨Óiserrorªº¼gªº¤è¦¡¸ò¨ç¼Æ«Ü¹³¡AÁÂÁ«ü¾É¡I
¦A½Ð±Ð¤@¤Uapplication¤Þ¥Îªº¨ç¼Æ¤¤¡A¬°¤°»ò¤£¯à¨Ï¥Îoffset©O??
¨º¦pªG§Ú·Q§ìªºª½¦b¯Á¤Þ¦Cªº¥ªÃä¡A¦]¬°vlookup¥u¯à©¹¥kÃä§ì­È¡A¦ý¬O
¦³®É­Ô¼Æ¾Ú¦b°}¦Cªº¥ªÃä¡A¨º¸Ó«ç»ò³B²z°Ú¡H

TOP

¦^´_ 11# sang520


    If IsError(Application.VLookup(y, Sheet2.[A1:B100], 2, 0)) Then
MsgBox "­pºâ¦³»~"
Else
Range("B2").Value = Application.VLookup(y, Sheet2.[A1:B100], 2, 0)
End If
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

·Q¦b½Ð°Ý¤@¤U¡I¦b¨ç¼Æªº®É­Ô¦pªG»Ý­n§PÂ_¬O§_¿ù»~ªº®É­Ô·|±`¥Î
¡yif¡z·f°t¡yiserror¡z¥h°£¿ù»~ªºÅã¥Ü¤è¦¡¡A¥i¬O¦bVBAªº®É­Ô¸Ó¦p
¦ó¥h°£¿ù©O¡H

TOP

ÁÂÁ¡I±zªº¸Ñµª¤w¸gÅý§Ú§ä¨ìµª®×¤F¡I
¯uªº¬O¨ü¯q¨}¦h¡I

TOP

VLOOKUP¨ç¼Æ¥²¶·ª`·Nªí®æ¤º¸ê®Æ«¬ºA»P·j´M°Ñ¼Æ¸ê®Æ«¬ºA¬O§_¬Û²Å
¤]´N¬O»¡·íªí®æ²Ä¤@Äæ¬O¼Æ­È§AªºVLOOKUP²Ä¤@­Ó°Ñ¼Æ¤]­n¬O¼Æ­È
ªí®æ²Ä¤@Äæ¬O¦r¦ê§AªºVLOOKUP²Ä¤@­Ó°Ñ¼Æ¤]­n¬O¦r¦ê
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ sang520 ©ó 2011-6-30 11:26 ½s¿è

§Ú¤S¹J¨ì°ÝÃD¤F¡I¬°¤°»ò§Ú§â¨ä¥LÀɮתº¸ê®Æ½Æ»s¡÷¶K¤W­È¨ìsheet2³o­Ó¬¡­¶
¡Iµ{¦¡½X³£¨SÅÜ¡A¦ý¬O¤S§ì¤£¨ì¤F¡I¬O¤°»ò°ÝÃD°Ú????

Book1(¼W¥[¸ê®Æµ§¼Æ).rar (86.04 KB)

TOP

§A§ây©w¸q¬°String
y=­È´N¬O¦r²Å"100006"¡A¦Ó¬°¬O¼Æ¦r100006
¦bªí¤G¤¤¥u¦³¼Æ¦r10006¡A§ä¤£¨ì"100006"ªº¦r²Å
©Ò¥H¥u¯à¥Î¼Æ¦rÃþ«¬
Long©Ò¥Nªíªº·N«ä¬O¤°»ò©O¡A³Ì¦n¬O§A¦Û¤v§äexcel¤¤ªº»¡©ú¡A¤~·|¦³¦L¶H¡I

TOP

«¢«¢¡IÁÂÁÂa8350070 À°§Ú´M§ä¿ù»~¡A¤]ÁÂÁÂoobirdªº­@¤ß¸Ñµª¡A°¸¸g¹L´ú¸Õ¯uªº§ì¨ì­È¤F¡I
¶W¶}¤ßªº¡A¦ý¬O¦³­ÓºÃ°Ý¡A·í«Å§i®É¬°¦ó¤£¯à¨Ï¥Îstring¤Ï¦Ó¥Îlong¤~¦æ¡H¨º¦¹¨â­Ó¨Ï¥Îªº¤è¦¡
¬°¦ó?¨ºLong©Ò¥Nªíªº·N«ä¬O¤°»ò©O¡H¯à§_±Ð¾É¤@¤U¡AÁÂÁ¡I
¹ê¦b·PÁÂ¥H¤WÀ°¦£§Ú¸Ñµªªº«e½ú­Ì¡AÁÂÁ¡I

TOP

        ÀR«ä¦Û¦b : ¡i¦æµ½­n¤Î®É¡j¦æµ½­n¤Î®É¡A¥\¼w­n«ùÄò¡C¦p¿N¶}¤ô¤@¯ë¡A¥¼¿N¶}¤§«e¤d¸U¤£­n°±º¶¤õ­Ô¡A§_«h­«¨Ó´N¤Ó¶O¨Æ¤F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD