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

[µo°Ý] ¦p¦ó°õ¦æ2­ÓSetFocus?

(ÁÂÁÂG¤j¡A§¹¦¨)¦p¦ó¦b«ö¤U«ö¶s«á~°õ¦æ¨ìTextBox1µM«á§@Enterªº°Ê§@(¦Û­qªí³æ)

¥»©«³Ì«á¥Ñ av8d ©ó 2012-6-28 17:00 ½s¿è

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    If KeyCode = 13 Then ActiveSheet.UsedRange.AutoFilter 1, "=" & DateValue(TextBox1)
End Sub

¥H¤W¬O¦pªG¦bTextBox1«öEnter«á§@°Ê§@

¦pªG­n¦b«ö¤UCommandButton«ö¶s«á~°õ¦æ¨ìTextBox1µM«á§@Enterªº°Ê§@¸Ó¦p¦ó¼g?

(¥H¤W³£¬O¦b¦Û­qªí³æ°õ¦æ)

KeyPress

TOP

¦^´_ 1# av8d
¦pªG­n¦b«ö¤UCommandButton«ö¶s«á~°õ¦æ¨ìTextBox1µM«á§@Enterªº°Ê§@¸Ó¦p¦ó¼g?
§Aªº·N«ä¬O  «ö¤UCommandButton «á·|°õ¦æ¨ì TextBox1_KeyDown³oµ{§Ç¬O¶Ü?
  1. Private Sub CommandButton1_Click()
  2.      TheAutoFilter
  3. End Sub
  4. Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
  5.     If KeyCode = 13 Then  TheAutoFilter
  6. End Sub
  7. Private Sub  TheAutoFilter()
  8.       ActiveSheet.UsedRange.AutoFilter 1, "=" & DateValue(TextBox1)
  9. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ av8d ©ó 2012-6-28 16:06 ½s¿è

¦^´_ 2# GBKEE


    TextBox1 = Date
    TextBox1.SetFocus
    SendKeys "{Enter}"
¥i¬O¦pªG
    UserForm1.TextBox1.SetFocus
    UserForm1.SendKeys "{Enter}"
´N¤£¦æ

TOP

[µo°Ý] ¦p¦ó°õ¦æ2­ÓSetFocus?

TextBox7 = Month(Date) & "/" & Day(Date)
    TextBox7.SetFocus
    SendKeys "{Enter}"
   
    TextBox1 = Date
    OptionButton2.Value = True
    TextBox2.SetFocus


¬õ¦âªº³¡¤À·|µLªk³Q°õ¦æ¨ì¦pªG§âTextBox2.SetFocus®³±¼«h¥i¥H°õ¦æ
¬O§_2­ÓSetFocus¸û¤W¤èªº·|³Q¬Ù²¤©O?

¦^´_ 4# av8d
  1. Option Explicit
  2. Private Sub Ex()
  3.     TextBox7 = Month(Date) & "/" & Day(Date)
  4.     TextBox1.SetFocus
  5.     Application.SendKeys ("~")      'KeyCode = 13
  6.     'Application.SendKeys "{ENTER}" 'KeyCode = 43
  7.     DoEvents                        '¨Ï¥ÎSendKeys ­n±N±±¨îÅv¶Ç¦^¨t²Î
  8.     TextBox1 = Date
  9.     OptionButton2.Value = True
  10.     TextBox2.SetFocus
  11. End Sub
  12. Private Sub TextBox7_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
  13.    MsgBox KeyCode
  14.     If KeyCode = 13 Then ActiveSheet.UsedRange.AutoFilter 1, "=" & DateValue(TextBox1)
  15. End Sub
½Æ»s¥N½X

TOP

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