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

°£¤F¨Ï¥Îon error resume next, ¦p¦ó¤£Åã¥Ü¿ù»~

«öENTER ¦V¤U¼vÅTactivecell ¦ì¸m

¥»©«³Ì«á¥Ñ enoch ©ó 2012-7-3 10:13 ½s¿è

µ{¦¡¥Î§@¦b²Ä2Äæ¿é¤J¸ê®Æ«á, ·|¤ñ¹ï¸ê®Æ¬O§_¯à¦b¸ê®Æ®w§ä¨ì,
­Y§ä¨ì·|¦b²Ä4ÄæÅã¥Ü§ä¨ì¸ê®Æ, ­Y¤£¦s¦b·|Åã¥Ü"§ä¤£¨ì", ¤Îµo¥XÁn­µ

­Y excel ³]©w¤F«öenterÁä«á, Àx¦s®æ¦V¤U,
·íµ{¦¡¦b²Ä3¦æ¿é¤J¸ê®Æ«öenter«á, ¦]¬°Àx¦s®æ¤w¥h¤F²Ä4¦æ,
µ{¦¡·|¿ù»~³B²z²Ä4¦æ¸ê®Æ
½Ð°ÝÀ³¦p¦ó­×§ï, ÁקKµ{¦¡»{¿ùactivecell

¥t¥~·í¨Ï¥ÎÀɮפºªº¦WºÙ½d³ò"data", «e­±¬O§_¤@©w»Ý­n¥[¤W©Ò¦b¤u§@ªí"information"

½Ð«ü±Ð
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2.     On Error GoTo errhandler
  3.    Dim row  As Integer
  4.     row = ActiveCell.row
  5.     If Target.Column <> 2 Then Exit Sub
  6.     If Cells(row, "A") <> "" Then
  7.           Cells(row, "D") = Application.WorksheetFunction.VLookup(Cells(row, "B"), Sheets("Information").Range("data"), 1, False)
  8.     End If
  9.     Exit Sub
  10. errhandler:


  11. Call Beep
  12. Cells(row, "D") = "§ä¤£¨ì"
  13. End Sub
½Æ»s¥N½X

TOP

°£¤F¨Ï¥Îon error resume next, ¦p¦ó¤£Åã¥Ü¿ù»~

¦bExcel¤½¦¡, ¥i¥H¦bVlookup«e­±¥[¤WISNA , ÁקK§ä¤£¨ì¸ê®Æ®É¥X²{ERROR

­YªG¦bVBA, °£¤F¨Ï¥Î on error resume next
¦p¦óÁקK·í¨Ï¥ÎApplication.WorksheetFunction.VLookup §ä¤£¨ì¸ê®Æ®É¥X²{¿ù»~

VBA¦³VBA¬d¸ßªº¤èªk¡A®ÄªG¤]¤ñ½Õ¥Î¤u§@ªí¨ç¼Æ±j¦h¤F
¦ÛµM¤]¨S¦³½Õ¥Î¤u§@ªí¨ç¼Æ¬d¸ß¥X¿ùªº¯ÊÂI¡C

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-7-3 15:03 ½s¿è

¦^´_ 1# 2# enoch
  1. Option Explicit
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3.    Dim xlrow  As Integer, xlLook As Variant
  4.     If Target.Column <> 2 Then Exit Sub
  5.     xlrow = Target.Row
  6.     If Cells(xlrow, "A") <> "" Then
  7.          'xlLook = Application.WorksheetFunction.VLookup(Cells(xlrow, "B"), [data], 1, False)
  8.          '¨Ï¥Î¤u§@ªí¨ç¼Æ Application.WorksheetFunction ¦p¶Ç¦^¿ù»~­È ¨t²Î·|¦^À³°õ¦æ¤Wªº¿ù»~¤¤¬qµ{¦¡
  9.          xlLook = Application.VLookup(Cells(xlrow, "B"), [data], 1, False)
  10.         '¦ý¤£¥[¤WWorksheetFunction  ¦p¶Ç¦^¿ù»~­È ¨t²Î¤£·|¦^À³°õ¦æ¤Wªº¿ù»~
  11.         '¦ýÅܼƫ¬ºA »Ý³]¬° Variant
  12.         Cells(xlrow, "D") = IIf(Not IsError(xlLook), xlLook, "§ä¤£¨ì")
  13.     End If
  14. End Sub
½Æ»s¥N½X

TOP

½Ð°ÝGBKEE

½Ð°Ý¥ÎExcel function®É, ¦ó®É¨M©w­n§_¥[WorksheetFunction©O?
¨âªÌ¥u¦b©óWorksheetFunction  ·|¦^À³°õ¦æ¤Wªº¿ù»~¶Ü?

TOP

¦^´_ 5# enoch
Application.VLookup µ¥¦P Application.WorksheetFunction.VLookup   
®t§O¦b¨ç¼Æ¶Ç¦^¿ù»~­È®É, «eªÌ¤£¥[WorksheetFunction, vba¤£·|²£¥Íµ{¦¡¤Wªº¿ù»~­È

TOP

©ú¥Õ¤F, ÁÂÁÂGBKEE

TOP

        ÀR«ä¦Û¦b : ½_ÁJµ²±o¶V¹¡º¡¡A¶V·|©¹¤U««¡A¤@­Ó¤H¶V¦³¦¨´N¡A´N­n¶V¦³Á¾¨Rªº¯ÝÃÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD