excel - Troble with updating the list box -
I have created an Excel user form with a list box with three combo boxes and 3 columns.
When the user selects a value from the drop down list and click on the Add button it will be displayed in the list box - Completed
When selecting an item in the user list box Then it will be displayed again in the drop down list -
But when the user selects the item in the list box and clicks on the update button, then click the list box (), call it (), call me This list is yours
Please update the code
code to add value to the list box from the drop down list
private Sub cmd_click () call lstValues.AddItem (AddPpayTierOption (cboPpayTier.Value)) lstValues. List (Ubuntu (lstValues.List, COL_BRAND) = cboBrandTier.Value lstValues.List (Ubound (lstValues.List, COL_GEN) = cboGenTier.Value End Sub When clicking the item This will display values in the drop down list in the list box
private sub lstValues_Click () Dim I as Long cmdEdit.Enabled = true cmdRemove.Enabled = true if lstValues.ListIndex & lt; & Gt; -1 if I = lstValues.ColumnCount- 1 for I = 0 then cboPayTier.Value = lstValues.Column (I) otherwise if I = 1 then cboBrandTier.Value = lstValues.Column (I) otherwise if I = 2 then CboGenTier.Value = lstValues.Column (I) End if end if end if next I end if end of the sub
when the user clicks the update button code.
When it goes to the lstValues.Column (j) = cboPpayTier.Value line, it calls the lstValues_Click () function, I do not code to call that function Fan Please help Private Sub CMDAdit_Link () Dimmed as J Jammu Long Dem Variants if lstValues.ListIndex & lt; & Gt; -1 then for J = 0 lstValues.ColumnCount- 1 if J = 0 then lstValues.Column (j) = cboPpayTier.Value Else if J = 1 then lstValues.Column (j) = cboBrandTier.Alue Else if j = 2 then LstValues.Column (j) = cboGenTier.Value End If the end ends if the next j end if end please give me more clarification.
Two options:
- To disable event processing < Code> Application.EnableEvents = False . To enable and re-enable
Application.EnableEvents = True , it disables all event handling, so keep it on both sides of the code, which otherwise would Will trigger the event that you do not want. - Set it before the announce announcement code that will trigger an event that you do not want
sub in the event itself, check the flag, and exit If this is set, either reset the flag on the other side of the event that triggers or the event sub does not prevent event firing, but it prevents the execution of the code that you Do not want to. As the request, option 2 option 2
In a standard module, at the top (just after option is clear ), this Add code boolean in your code
'somewhere in your code', when your Regarding execution of some arguments that will trigger an Event InhibitEvent = True '... trigger inhibitEvent = False event sub You do not want to execute (for example Change a listback event for event) Personal sub-listBox1_Change () 'Stop the rest of the event left'
Comments
Post a Comment