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

[µo°Ý] ½Ð±ÐTextBox¿é¤J¿ù»~¦p¦ó¦^¨ì­ì¦ì¸m

[µo°Ý] ½Ð±ÐTextBox¿é¤J¿ù»~¦p¦ó¦^¨ì­ì¦ì¸m

½Ð±Ð¦U¦ì¥ý¶i:
TextBox1¿é¤J¿ù»~¸õ¥XMsgBox´£¥Üµøµ¡«á­n¦p¦ó¦^¨ìTextBox1­«·s¿é¤J
            MsgBox "¿é¤J¿ù»~"
            TextBox1 = ""
            TextBox1.SetFocus
¨Ï¥ÎSetFocus¥¢±ÑµJÂI·|¸õ¨ìTextBox2
¨Ï¥ÎApplication.SendKeys "{up}"¸g±`·|³y¦¨NumLookÃö³¬
  1. Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
  2.     If KeyCode = 13 And TextBox1 > "" Then
  3.         Dim Rng As Range
  4.         Dim ax As Variant
  5.         Dim bx As String
  6.         Set Rng = Sheets("data").[K1:L24]
  7.         bx = TextBox1.Text
  8.         ax = Application.VLookup(bx, Rng, 2, 0)
  9.         If Not IsError(ax) Then
  10.             Label4 = ax
  11.         Else
  12.             MsgBox "¿é¤J¿ù»~"
  13.             TextBox1 = ""
  14.             Application.SendKeys "{up}"
  15.             Exit Sub
  16.         End If
  17.     End If
  18. End Sub
½Æ»s¥N½X

¼È®É¥ý¥Î¥þ°ìÅܼƨӸѨM
  1. Dim bCancel As Boolean

  2. Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  3. Cancel = bCancel
  4. bCancel = False
  5. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# koo

Cancel = True §Y¥i¨ú®øExit°Ê§@, Åý¾nÂI¯d¦b­ì¦ì,
¦ý¥[­ÓMsgbox«á, ¾nÂI¾ã­Ó®ø¥¢¤£¨£¤F!
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1 = 1 Then
¡@Cancel = True
¡@TextBox1 = ""
¡@MsgBox "ERROR"¡@'®ø°£¦¹¦æ¦A¸Õ¬Ý¬Ý
Else
¡@MsgBox "³q¹L"
End If
End Sub
¡@
¦ýÃD¥D¥Îªº¬OKeyDown¨Æ¥ó¡AEnter«á¾nÂI¤w²¾¦ì¡A¦^¤£¤FÀYªº¡I
¡@

TOP

¦^´_ 3# ­ã´£³¡ªL
Cancel = True §Y¥i¨ú®øExit°Ê§@, Åý¾nÂI¯d¦b­ì¦ì
¦P²z
ByVal KeyCode As MSForms.ReturnInteger
  1. Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
  2.     If KeyCode = 13 And TextBox1 > "" Then
  3.         Dim Rng As Range
  4.         Dim ax As Variant
  5.         Dim bx As String
  6.         Set Rng = Sheets("data").[K1:L24]
  7.         bx = TextBox1.Text
  8.         ax = Application.VLookup(bx, Rng, 2, 0)
  9.         If Not IsError(ax) Then
  10.             Label4 = ax
  11.         Else
  12.             MsgBox "¿é¤J¿ù»~"
  13.             'TextBox1 = ""
  14.             KeyCode = True
  15.             TextBox1.SelStart = 0
  16.             TextBox1.SelLength = Len(TextBox1)
  17.         End If
  18.     End If
  19. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE


¦n­Ó KeyCode = True, ¦h¦¬¤@©Û!
¤£¹L MSGBOX «á, ¾nÂIÁÙ¬O¬Ý¤£¨ì, ¤£ª¾¬O§_ª©¥»°ÝÃD(XP + 2000)?

TOP

¦^´_ 5# ­ã´£³¡ªL
¨S¦³2000¥i¤F¸Ñ
  1. TextBox1.SelStart = 0
  2. TextBox1.SelLength = Len(TextBox1)
½Æ»s¥N½X
¸Õ¸Õ¤£MsgBox, ³o¬qµ{¦¡½X¥i¥Î¶Ü?
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 6# GBKEE

¥[¨º¨â¦æ¤]¬O¨S¥Î, MSGBOX«á, ¾nÂI§¹¥þ®ø¥¢~~
¬°¤F§JªA³o­Ó°ÝÃD, ¥H«e³£¦bForm¤U¤è¥[­ÓLabel°µ¬°»¡©ú´£¥Ü¤Îĵ§i¥Î(¦h­Óbeep­µ®Ä),
¤]°®¯Ü¿é¤J§¹¦¨«á, ¦bµn¿ý«ö¶s®É¦A°õ¦æ«e¸mÀˬd, §¹¥þ¥¿½T¦A«áÄò¤u§@,
¦³®É¦b¤u§@ªí³]­p¦¨Ãþ¿é¤Jªí³æ, ¤Ï¦Ó§ó¦n¥Î~~

TOP

ÁÂÁÂ2¦ì¤j¤j¸Ñ»¡
¨Ï¥ÎKeyCode = True¥i¥H¥¿±`°õ¦æW7+2013
·PÁÂ

            MsgBox "¿é¤J¿ù»~"
            KeyCode = True
            TextBox1.SelStart = 0
            TextBox1.SelLength = Len(TextBox1)

TOP

        ÀR«ä¦Û¦b : ¦³´¼¼z¤~¯à¤À¿ëµ½´c¨¸¥¿¡F¦³Á¾µê¤~¯à«Ø¥ß¬üº¡¤H¥Í¡C
ªð¦^¦Cªí ¤W¤@¥DÃD