![]() |
Assigning a sub to a specific keybordkey
Hi!
I have a userform in Excel (version 2000) which has a textbox (txtInvoice) and a listbox (lstInvoices). When the user, after typing the invoicenumber into the textbox, presses the Enter-key (on the numerical keypad) the number should be added to the listbox. How do I assign the sub that does the transfer to the Enter-key? TIA PO |
Assigning a sub to a specific keybordkey
"PO" <po wrote in message ...
Hi! I have a userform in Excel (version 2000) which has a textbox (txtInvoice) and a listbox (lstInvoices). When the user, after typing the invoicenumber into the textbox, presses the Enter-key (on the numerical keypad) the number should be added to the listbox. How do I assign the sub that does the transfer to the Enter-key? TIA PO PO Try this.. '''' After user enter info they press Tab or Return key the if statement will evaluate which key and proceed'''' Private Sub txtInvoice_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) 'tab key If KeyCode = "9" Or KeyCode = "13" Then ''''''''Your code goes here'''''' End If End Sub HTH Charles |
All times are GMT +1. The time now is 03:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com