Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a userform with 23 textboxes and 2 comboboxes. In an effort to
advance the cursor to the next textbox or combobox if the user hit the ENTER key, I have the following for each, ie a total of 25 of these routines (with appropriate adjustments to match): Private Sub TextBox6_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If KeyCode = 13 Then Textbox7.SetFocus End Sub I was wondering if there was a way to condense to one routine and use SELECT CASE, or IF-THEN? I don't know what the first line would have to be (Private Sub...), but I am thinking along the lines that I would need to know the ACTIVE (current textbox), then be able to advance using a variable, similar to below: DIM b as Interger b would need to be a value to represent active textbox then code might look like this: If KeyCode = 13 Then Textbox & (b+1).SetFocus Thanks, Les |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Condensing data from 3D to 2D | Excel Worksheet Functions | |||
Condensing Formula | Excel Discussion (Misc queries) | |||
Need help condensing with-end with code | Excel Programming | |||
Condensing my worksheet | Excel Worksheet Functions | |||
dialog box for active cell task to speed repeditive task | Excel Programming |