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

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

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-9-20 11:44 ½s¿è

¦^´_ 10# e19821223
¬O³o¼Ë¶Ü?
  1. Option Explicit
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3.     Dim data As Range
  4.     Application.EnableEvents = False
  5.     If Target.Address(0, 0) = "B1" Then Exit Sub
  6.     With Range("C13:C32")
  7.         If Not .Find(What:="#N/A", LookIn:=xlValues) Is Nothing Then .Cells = ""
  8.     End With
  9.     Set data = ['sheet2'!$A$1:B$1000]
  10.     [b1] = Application.VLookup([a1], data, 2, 0)
  11.     Application.EnableEvents = True
  12. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 11# GBKEE
  1. «D±`·PÁÂG¤jªº±Ð¾É
  2. Option Explicit
  3. Private Sub Worksheet_Change(ByVal Target As Range)
  4.     Dim data As Range
  5.    [color=Red] Dim x As Range
  6.     Dim y As Range[/color]
  7.     Application.EnableEvents = False
  8.     If Target.Address(0, 0) = "[color=Red]B1:B10[/color]" Then Exit Sub
  9.     With Range("[color=Red]B1:B10[/color]")
  10.         If Not .Find(What:="#N/A", LookIn:=xlValues) Is Nothing Then .Cells = ""
  11.     End With
  12.     Set data = ['sheet2'!$A$1:B$1000]
  13.     Y = Application.VLookup(X, data, 2, 0)
  14.     Application.EnableEvents = True
  15. End Sub
½Æ»s¥N½X
´ú¸Õ¥H¤Wªº»yªk ¦ý ¦n¹³ÁÙ¬O¤£¦æ ¥¿¦b´M«ä ¬O§_­þ¸Ì¦³½Ä¬ð

TOP

¦^´_ 11# GBKEE
§Ú±NÀɮפW¶Ç¤F ½ÐG¤j¦³ªÅ¹L¥Ø¤@¤U ÁÂÁÂ

¸ß°Ý.rar (13.84 KB)

TOP

¦^´_ 13# e19821223
¬O´Á±æ¦p¦¹¶Ü?
  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
·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

¦^´_ 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

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

TOP

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

TOP

¦^´_ 18# e19821223

·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

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD