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

[µo°Ý] Textbox ¨â¦ì¼Æªº³]©w

[µo°Ý] Textbox ¨â¦ì¼Æªº³]©w

·Q½Ð±Ð¤@¤U¡A§Ú¦³¤@­Ó textbox¡A§Æ±æ§O¤H¿é¤Jªº½d³ò­n¤j©ó 40 ©M¤p©ó 50¡A
¦pªG¤£¬Oªº¸Ü¡A­n show ¥X¤@­Óªí³æ´£¿ô§O¤H­«·s¿é¤J¡Aµ{¦¡¦p¤U¡G
Private Sub textbox32_Change()
If textbox32.Value > 50 or textbox32.Value < 40 Then
UserForm2.Show     'Please fill in 40~50.
textbox32.Value = ""
End If
End Sub

¦ý¬O <40 ³o¤@¶µ¡A¥u­n key in ¶i¤@­Ó­Ó¦ì¼Æ¡Aĵ§iªí³æ°¨¤W´N¯B²{~~~
³o­n«ç»ò¿ì¡H

·PÁ¤j¤jÀ°¦£~~

¦^´_ 1# bowwow1975
TextBox32 ¿é¤J«á«ö [Enter]  (±±¨î¶µ¥¢¥h¾nÂI)
  1. 'Enter¡BExit ¨Æ¥ó
  2. 'Enter ¥D­nµo¥Í¦b¤@­Ó±±¨î¶µ¡A±q¦P¤@ªí³æ¤Wªº¥t¤@­Ó±±¨î¶µ¨ú±o¾nÂI¤§«e
  3. 'Exit ·|¦b¤@­Ó±±¨î¶µ¥¢¥h¾nÂI®Éµo¥Í¡C
  4. Option Explicit
  5. Dim Exit_Msg As Boolean                     'ªí³æ¨p¥ÎÅܼÆ
  6. Private Sub TextBox32_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  7.     If Exit_Msg = True Then Exit Sub            '©|¦b¿é¤J¤¤, ¦¹®É¦pÃö³¬ªí³æ,ÁÙ¬O·|°õ¦æ¦¹µ{§Ç
  8.     If Not IsNumeric(TextBox32) Or TextBox32 < 40 Or TextBox32 > 50 Then
  9.         Cancel = True                           'True ªí¥ÜÀ³¥Îµ{¦¡¶·³B²z¦¹¨Æ¥ó¡A¥B¾nÂI¤´«O¯d¦b¥Ø«e±±¨î¶µ¡C
  10.         With TextBox32                          '¿ï¾Ü¥H¿é¤J¤å¦r
  11.             .SelStart = 0
  12.             .SelLength = Len(.Text)
  13.        End With
  14.        MsgBox "TextBox32 ¶·¬O ¤j©ó 40 ©M¤p©ó 50  "
  15.     End If
  16. End Sub
  17. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
  18.     Exit_Msg = True
  19. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# GBKEE

¤£¦n·N«ä¡A¤§«eªº¤w¥Î¨ä¥L¤èªk¸Ñ¨M¡A¦ý²{¦b­É¥Î§Aªº¤èªk¡A¥X²{¤F¤@ÂI¤p°ÝÃD

§Ú§âµ{¦¡§ï¬°¦p¤U
  1. Private Sub TextBox34_Change()

  2. With Sheet4
  3. .Range("H4").Value = textbox34.Text
  4. End With
  5. End Sub
  6. ' ¥H¤WÅܧó textbox ´N¶¶«KÅܧóÀx¦s®æ
  7. ' ¥H¤U´N¨Ì·Ó§Aªºµ{¦¡½X¼¶¼g

  8. Private Sub TextBox34_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  9. Dim Exit_Msg As Boolean
  10.    
  11.     If Exit_Msg = True Then Exit Sub
  12.     If Not IsNumeric(TextBox32) Sheets(4).Range("h4") < Sheets(4).Range("C35") Or Sheets(4).Range("h4") > Sheets(4).Range("C36") Then
  13.     Cancel = True
  14.     'With textbox34
  15.     '    .SelStart = 0
  16.     '    .SelLength = Len(.Text)
  17.     '    End With
  18.         MsgBox "Np ¶·¬O ¤j©ó" & Sheets(4).Range("C35") & " ©M¤p©ó " & Sheets(4).Range("C34")
  19.     End If

  20. End Sub

  21. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

  22.     Exit_Msg = True
  23. End Sub
½Æ»s¥N½X
¤£ºÞ§Ú textbox34 ¿é¤J¤°»ò­È¡AMsgbox ³£·|¥X²{
³Ì«á§ÚÃö±¼µøµ¡¡AMsgbox ÁÙ·|¦A¥X²{¤@¦¸~~
½Ð°Ý³o­n«ç»ò¸Ñ¡H

·P¿E¤£ºÉ¡I

TOP

¦^´_ 3# bowwow1975

¤£¦n·N«ä¡A¤w¸Ñ¨M¡I¡I¡I
·PÁ¦³Ãöª`ªº¤j¤j­Ì¡I

TOP

¦^´_ 4# bowwow1975
¦p¦ó¸Ñ¨M ¥æ¬y¤@¤U
3#ªº¿ù»~
  1. Option Explicit
  2. Dim Exit_Msg As Boolean   '¦¹ÅܼƬOªí³æ¼Ò²Õªº¨p¥ÎÅܼÆ,¶·¬O¸m©óªí³æ¯ë¼Ò²Õ³»³¡
  3. Private Sub TextBox34_Change()
  4.     With Sheet4
  5.         .Range("H4").Value = TextBox34.Text
  6.     End With
  7. End Sub
  8. Private Sub TextBox34_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  9.     If Exit_Msg = True Then Exit Sub
  10.     If Not IsNumeric(TextBox34) Or Sheets(4).Range("h4") < Sheets(4).Range("C35") Or Sheets(4).Range("h4") > Sheets(4).Range("C34") Then
  11.     '*****************************************************************************************************************
  12.     '³o¸Ì¦³¥Ù¬Þ C34,C35, C36 ¼Æ¾Ú¬O­þ¸Ì¤~¥¿½T!!!!
  13.     'If Not IsNumeric(TextBox32) Sheets(4).Range("h4") < Sheets(4).Range("C35") Or Sheets(4).Range("h4") > Sheets(4).Range("C36") Then
  14.     'MsgBox "Np ¶·¬O ¤j©ó" & Sheets(4).Range("C35") & " ©M¤p©ó " & Sheets(4).Range("C34")
  15.     '******************************************************************************************************************
  16.     Cancel = True
  17.     'With textbox34
  18.     '    .SelStart = 0
  19.     '    .SelLength = Len(.Text)
  20.     '    End With
  21.         MsgBox "Np ¶·¬O ¤j©ó" & Sheets(4).Range("C35") & " ©M¤p©ó " & Sheets(4).Range("C34")
  22.     End If
  23. End Sub
  24. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
  25.     Exit_Msg = True
  26. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¤£­nÀH¤ß©Ò±ý¡A­nÀH¤ß±Ð¨|¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD