Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using a form in a spreadsheet to select customers. I can use my mouse
and select the customer. I would like to type in the box to select the customer by name instead. I have seen it work in other applications. I just cannot figure out how to make it work. Private Sub cboCustomerID_Change() If Not IsNull(Me.cboCustomerID) Then LoadStoreList LoadSOForCustomer Me.cboCustomerID End If Me.cboStoreID.SetFocus End Sub Private Sub cboStoreID_Change() If Not IsNull(Me.cboStoreID) Then LoadSOForStore Me.cboStoreID Else If Not IsNull(Me.cboCustomerID) Then LoadSOForCustomer Me.cboCustomerID End If End If Me.lstShippingOrders.SetFocus End Sub When I have selected the customer with the mouse or start typing I loose focus, because of the Me.cboStoreID.SetFocus after the End If. This was written by some one else and I am trying to modify it to make it more user friendly. Thanks for the help. -- Thanks Mark C. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mark,
Instead of running the code on the on Change event if you change it to the AfterUpdate event. This means that the user can change it/type it and then your code will run when the user moves away either by clicking into another text box or pressing tab etc. James |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks James
That made it do what i wanted, now i get a " Runtime error: 9 - Subscript out of range" . I am trying to find the error in the code. If you have any ideas let me know. -- Thanks Mark C. " wrote: Hi Mark, Instead of running the code on the on Change event if you change it to the AfterUpdate event. This means that the user can change it/type it and then your code will run when the user moves away either by clicking into another text box or pressing tab etc. James |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mark,
From the code you posted I can't see anything obvious, which line does it highlight the error with? Subscript out of range is typically an error assosiated with not finding a particular object like you telling the code to select sheet4 when in fact you don't have a sheet4. Alternatively you can email it to me. James |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Making User defined functions available in all new workbooks | Excel Worksheet Functions | |||
making NT user/login user appear in a cell | Excel Worksheet Functions | |||
Using VBA to make a user input a note when making changes to a cel | Excel Worksheet Functions | |||
Making a macro run when the user closes a workbook | Excel Programming | |||
Making a macro run when the user closes a workbook | Excel Programming |