Word VBA - Listboxes Swapping Round


New Member
Mar 4, 2020
Office Version

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!


Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...