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

[µo°Ý] ½Ð°ÝÃö©ó¸ó¤u§@ªívlookupªºvba»yªk

[µo°Ý] ½Ð°ÝÃö©ó¸ó¤u§@ªívlookupªºvba»yªk

  1. Private Sub WORKSHEET_CHANGE()
  2. Dim data As Range
  3. Set data = ['sheet2'!$A$1:$B$10]
  4. [b1] = Application.WorksheetFunction.VLookup([a1], data, 2, 0)
  5. End Sub
½Æ»s¥N½X
¥H¤W¬O§Úª¦½×¾Âªº¤å©Ò¼g¥X¨Óªº ·Q­n¦bsheet1ªºa1:a10¥´¤W½s¸¹ «hb1:b10°Ñ³ya1:a10ªº½s½X§ä´Msheet2ªº¸ê®Æ
¦ý «o¥X²{¤F"µLªk¨ú±oÃþ§O worksheetfanctionªºvlookupÄÝ©Ê"³o°T®§

·Ð½Ð¦U¦ì¤j¤j«ü±Ð¤@¤U ¸Ó«ç»ò­×¥¿§¹µ½ «D±`·P®¦!

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim data As Range, Y As Variant
    Application.EnableEvents = False
    If Not Intersect(Target, [A1:A10]) Is Nothing Then
       ' Set data = ['sheet2'!$A$1:B$25]
        'Y = Application.VLookup(Target, data, 2, 0)
        Y = Application.VLookup(Target, ['sheet2'!$A$1:B$25], 2, 0)
        Target.Offset(, 1) = IIf(IsError(Y), "", Y)
     End If
    Application.EnableEvents = True
End Sub


¤j¤j·Q½Ð°Ý³o¤@¬q¬O§_¦³¿ìªk§â¥~®Ø¦rÅéÃC¦â¤]¤@¨Ö±a¹L¨Ó©O??? ·P®¦.......

TOP

©êºp §Ú¦A¥J²Ó¬Ý¤F¤@¤U ¬O§Úªº¤u§@ªí¦WºÙ¥´¿ù ¥Ø«eOK¤F ·PÁÂG¤j!

TOP

¦^´_ 20# e19821223
2# ¦³»¡: ³oµ{§Ç¦WºÙ,¬OVBA¤u§@ªíª«¥ó¼Ò²Õªº¤º«Ø¨Æ¥ó¦WºÙ,¤£­n¶Ã¥Î
¨C¤@¤u§@ªí³£¥i¥H¥h½s³]³o¨Ç¤º«Ø¨Æ¥ó ,¬°¦ó¤£¦æ¤W¶ÇÀɮ׬ݬÝ
¦p¹Ï

   
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 19# GBKEE
§c...§Ú¬O¨å«¬ªº±Ëªñ¨D»·...§Ú¤@ª½ÁÙ¦b½×¾Âª¦¤å ³£¨S¬Ý¨ìÃþ¦üªº ­ì¨Ó¦b¹q¸£»¡©ú¸Ì

ÁÙ¦³ §Ú·Q°Ý¤@¤U ­Y»¡ ¥Î¬Û¦Pªº»yªk ¦ý ©ñ¦b¤£¦PªºSHEET¸Ì °Ñ³yªº½d³ò¤]¤£¤@¼Ë ¬O§_¥i¦æ©O
¤ñ¤è»¡ ­ì¥»©ñ¦bSHEET1¸Ìªº¬OG¤j©Ò´£¨Ñªº
  1. Option Explicit
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3.     Dim data As Range, Y As Variant
  4.     Application.EnableEvents = False
  5.     If Not Intersect(Target, [A1:A10]) Is Nothing Then
  6.        ' Set data = ['sheet2'!$A$1:B$25]
  7.         'Y = Application.VLookup(Target, data, 2, 0)
  8.         Y = Application.VLookup(Target, ['sheet2'!$A$1:B$25], 2, 0)
  9.         Target.Offset(, 1) = IIf(IsError(Y), "", Y)
  10.      End If
  11.     Application.EnableEvents = True
  12. End Sub
½Æ»s¥N½X
¦ý §Ú­n¦A·Q­n¦bSHEET3(D1:D10) °Ñ³ySHEET4 (C1:D25) ´N­×¥¿¦¨
  1. Option Explicit
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3.     Dim data As Range, Y As Variant
  4.     Application.EnableEvents = False
  5.     If Not Intersect(Target, [D1:D10]) Is Nothing Then
  6.       
  7.         Y = Application.VLookup(Target, ['sheet4'!$C$1:D$25], 2, 0)
  8.         Target.Offset(, 1) = IIf(IsError(Y), "", Y)
  9.      End If
  10.     Application.EnableEvents = True
  11. End Sub
½Æ»s¥N½X
¦ý §Ú¦b´ú¸Õ®É ¦bSHEET3¨ÃµL°Ê§@(§Ú¬O¦³±N»yªk©ñ¨ìSHEET3¸Ì¤F)
¦ì²¾¼Æ¤]¬Û¦P ­nªº±ø¥ó¤]¬Û¦P ¥u¬O°Ñ³yªºSHEET¤£¤@¼Ë¦Ó¤w «oµLªk°õ¦æ ¤£ª¾¨ì©³¬O¬°¤°»ò

TOP

¦^´_ 18# e19821223

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 16# GBKEE
G¤j..§A»¡ªº"VBA »¡©ú"¬O¦b­þ¸Ì@@ ª¦¤F¦n¤@¬q®É¶¡ ¨ÌµM¨S§ä¨ì
©êºp ¯à§_¦b«ü¤Þ¤@¤U©ú¸ô ÁÂÁÂ

TOP

G¤j «D±`ÁÂÁ§A!
§Ú¦A¦hª¦¤@¤U¤å ¦A¦¸·PÁ±z´£¨Ñªº¸ê°T

TOP

¦^´_ 15# e19821223
vbaªº»¡©ú¤¤¦³½d¨Ò
  1. Intersect ¤èªk
  2. ½Ð°Ñ¾\®M¥Î¦Ü½d¨Ò¯S©w¶Ç¦^ Range ª«¥ó¡A¦¹ª«¥ó¥Nªí¨â­Ó©Î¦h­Ó½d³ò­«Å|ªº¯x§Î½d³ò¡C

  3. IIf ¨ç¼Æ
  4. ®Ú¾Ú¬Y¹Bºâ¦¡ªº­È¡A¨Ó¶Ç¦^¨â³¡¥÷¤¤ªº¨ä¤¤¤@­Ó¡C
  5. »yªk
  6. IIf(expr, truepart, falsepart)
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

«z! ¬Oªº §Ú´N¬O­n§e²{¦p¦¹ ·PÁÂG¤jªºÀ°¦£!
²{¦b¤ñ¸û¤£À´ªº
If Not Intersect(Target, [A1:A10]) Is Nothing Then
Target.Offset(, 1) = IIf(IsError(Y), "", Y)
¥H¤W¨â¬qªº·N«ä
¤£ª¾¬O§_¯à¦A·Ð½ÐG¤jªº¸Ñ´b
©êºp §Úª¾¹D§Ú·Ð¤FÂI...

TOP

        ÀR«ä¦Û¦b : ¤Ñ¤W³Ì¬ü¬O¬P¬P¡A¤H¥Í³Ì¬ü¬O·Å±¡¡C
ªð¦^¦Cªí ¤W¤@¥DÃD