Weird triggering event on listbox

Gringoire

Board Regular
Joined
Nov 18, 2016
Messages
71
Office Version
  1. 365
Platform
  1. Windows
Hi guys,
I found a strange behavior on my excel workbook.
There is an hidden sheet (below) used as support to save list for filling listboxes active controls (shown in other sheets) and/or saving information.
Some of these are simple range, someone are named ranges and one is a table:
zzxkYPZ.png

The strange thing is that, when I add a row to the orange table that is used by ONLY ONE of my listboxes,
VBA Code:
        'Aggiorno la lista commesse
        With shDEV_Utilities.ListObjects("Tab_consuntivi")
            Dim addedRow As ListRow
            Set addedRow = .ListRows.Add()
            With addedRow
                .Range(1) = jobn
            End With
            .Sort.SortFields.Clear                                          'elimino eventuali sort precedenti
            .Sort.SortFields.Add2 Key:=.ListColumns(1).Range
            .Sort.Apply
        End With
this create a Change() event on ALL the listboxes having their RowSource property linked to some list in this Sheet.
Anyway, my code works properly, but I would like to avoid to trig useless Change() events on controls that have not been modified, because it could lead to unexpected errors.

I know that it is possible to use Application.EnableEvents property to handle this issue, but I would like to understand why it happens before make my code more complex if not necessary...

thank you.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,743
Messages
6,174,244
Members
452,553
Latest member
red83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top