Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with sub..._Change
I use a sub to update the options in a listbox based on the selection
of a combobox. I have it set to update when the combobox changes: Private Sub ComboBoxgroupW_Change() With UserFormDesign .ListBoxW.RowSource = .ComboBoxgroupW.Value End With End Sub this is causing problems when the main program is running because apparently it updates as the main function iterates, and this statement assigns bad input to rowsource when the function has not completed running. Is there a better option to use than "Change." Or is there a way to disable this sub while the program is running? thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with sub..._Change
How about the combo's DropButtonClick event. It only gets loaded then when
someone goes to use it. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Jacob" wrote in message oups.com... I use a sub to update the options in a listbox based on the selection of a combobox. I have it set to update when the combobox changes: Private Sub ComboBoxgroupW_Change() With UserFormDesign .ListBoxW.RowSource = .ComboBoxgroupW.Value End With End Sub this is causing problems when the main program is running because apparently it updates as the main function iterates, and this statement assigns bad input to rowsource when the function has not completed running. Is there a better option to use than "Change." Or is there a way to disable this sub while the program is running? thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with sub..._Change
I'm sure there are a couple of ways to fix the problem, here's one
way... Try declaring a public variable where your main code is running and giving you the problem, for example: Dim x as integer ' outside of your main code Sub yourmaincode() x = 100 the rest of your code x = 0 End Sub Then in your ComboBoxgroupW_Change code: Private Sub ComboBoxgroupW_Change() If x = 100 Then Exit Sub With UserFormDesign .ListBoxW.RowSource = .ComboBoxgroupW.Value End With End Sub Hope this helps you Sandy Jacob wrote: I use a sub to update the options in a listbox based on the selection of a combobox. I have it set to update when the combobox changes: Private Sub ComboBoxgroupW_Change() With UserFormDesign .ListBoxW.RowSource = .ComboBoxgroupW.Value End With End Sub this is causing problems when the main program is running because apparently it updates as the main function iterates, and this statement assigns bad input to rowsource when the function has not completed running. Is there a better option to use than "Change." Or is there a way to disable this sub while the program is running? thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with sub..._Change
I'll give that a try. Thanks!
Bob Phillips wrote: How about the combo's DropButtonClick event. It only gets loaded then when someone goes to use it. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Jacob" wrote in message oups.com... I use a sub to update the options in a listbox based on the selection of a combobox. I have it set to update when the combobox changes: Private Sub ComboBoxgroupW_Change() With UserFormDesign .ListBoxW.RowSource = .ComboBoxgroupW.Value End With End Sub this is causing problems when the main program is running because apparently it updates as the main function iterates, and this statement assigns bad input to rowsource when the function has not completed running. Is there a better option to use than "Change." Or is there a way to disable this sub while the program is running? thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with sub..._Change
Thanks Sandy. that is what I have done right now and it's working. I
just feel like it's a roundabout way of doing things. I guess if it works it works. Sandy wrote: I'm sure there are a couple of ways to fix the problem, here's one way... Try declaring a public variable where your main code is running and giving you the problem, for example: Dim x as integer ' outside of your main code Sub yourmaincode() x = 100 the rest of your code x = 0 End Sub Then in your ComboBoxgroupW_Change code: Private Sub ComboBoxgroupW_Change() If x = 100 Then Exit Sub With UserFormDesign .ListBoxW.RowSource = .ComboBoxgroupW.Value End With End Sub Hope this helps you Sandy Jacob wrote: I use a sub to update the options in a listbox based on the selection of a combobox. I have it set to update when the combobox changes: Private Sub ComboBoxgroupW_Change() With UserFormDesign .ListBoxW.RowSource = .ComboBoxgroupW.Value End With End Sub this is causing problems when the main program is running because apparently it updates as the main function iterates, and this statement assigns bad input to rowsource when the function has not completed running. Is there a better option to use than "Change." Or is there a way to disable this sub while the program is running? thanks |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with sub..._Change
I hear ya, but sometimes the simplest routes work the best. Just keep
debugging and looking for the places that fire the change event and see if you can't tweek the code so that it will only fire when you'd like it to update the ComboBox. Good luck Sandy Jacob wrote: Thanks Sandy. that is what I have done right now and it's working. I just feel like it's a roundabout way of doing things. I guess if it works it works. Sandy wrote: I'm sure there are a couple of ways to fix the problem, here's one way... Try declaring a public variable where your main code is running and giving you the problem, for example: Dim x as integer ' outside of your main code Sub yourmaincode() x = 100 the rest of your code x = 0 End Sub Then in your ComboBoxgroupW_Change code: Private Sub ComboBoxgroupW_Change() If x = 100 Then Exit Sub With UserFormDesign .ListBoxW.RowSource = .ComboBoxgroupW.Value End With End Sub Hope this helps you Sandy Jacob wrote: I use a sub to update the options in a listbox based on the selection of a combobox. I have it set to update when the combobox changes: Private Sub ComboBoxgroupW_Change() With UserFormDesign .ListBoxW.RowSource = .ComboBoxgroupW.Value End With End Sub this is causing problems when the main program is running because apparently it updates as the main function iterates, and this statement assigns bad input to rowsource when the function has not completed running. Is there a better option to use than "Change." Or is there a way to disable this sub while the program is running? thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Colon at the end of excel file name(ex: problem.xls:1, problem.xls | New Users to Excel | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
Why _Change(ByVal Target As Range) | Excel Programming | |||
problem with a conditional max problem | Excel Discussion (Misc queries) | |||
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? | Excel Programming |