Hi,
I have an excel file with three activex listboxes in cascade (the value of ListBox1 determines what will be shown in ListBox2 and so on).
ListBox1 gets the values directly via the ListFillRange property of the ListBox.
Then I have VBA code in the sheet, so when ListBox1 changes value, the values of ListBox2 will be automatically updated. This is the code I use:
The cell "L1" that I reference in the code usually has values like: "L2:L20"![]()
Please Login or Register to view this content.
The problem is that when I open the excel file, this sub seems to be executed automatically and it triggers an error popup:
The VBA editor is automatically opened and:compile error:
Method or data member not found
- The name of the sub appears highlighted in yellow:
Private Sub ListBox1_Change()
- In the line with "Set lbtarget = Me.ListBox2"
The part of ".ListBox2" (so the last part of the line) appears highlighted in blue
If I ignore the error everything works fine, it just when opening the file. But when sharing the file with other people, this error is a source of problems.
If before I save the file, I select any cell (so anything other than the listbox), then it opens fine.
But if before saving the file, the last selected thing is a listbox, then I get the error.
Any idea why this error happen?
Bookmarks