Word VBA - Listboxes Swapping Round

L

Legacy 458280

Guest
Hi,

I have a bit of an odd problem. In my document, I have a multipage in a userform. Page 0 of the multipage is a template, if you like, (visibility = False) with a couple of listboxes and comboboxes on it.
If a certain condition is met, it triggers the creation of a new 'tab' (multipage page) and copies and pastes the controls from page 0, onto the new page... For some reason, though, the listbox options in these new pages seem to be showing on the wrong listbox.

HOWEVER... this doesn't happen all the time. It appears to be a bug of sorts, as it seems that if I switch the listbox (control) numbers around in the 'initialize' sub, where the code populates the listboxes with different arrays, and then switch the numbers back again, then close the VBA editor and reopen the userform, this somehow seems to sort it. I have absolutely no idea what's causing this and just wondered if anybody else had experienced a similar issue.

It seems that now, trying the control number switching technique no longer works. As it is, I'm stuck with previously selected options from listbox 1 (as determined in the 'initialize' sub) being shown (selected) on listbox 2 instead of listbox 1, even though the selected item isn't even included in the initialize array for listbox 2.

Hopefully that made some sort of sense, although I couldn't be more confused at the moment.

Any suggestions would be greatly appreciated!

Cheers,
Luke
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,215,491
Messages
6,125,102
Members
449,205
Latest member
ralemanygarcia

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