I'm working on a searchfilter on 70+ checkbox choices. On each page from a multipage I've generated 44 checkboxes from an excel sheet.
I'm almost done with the searchfilter. My only issue is that I can't find a way to move a checkbox on page2 to page1 of a multipage.
Moving the checkbox to page1 will preserve the selection of the checkboxes so that is the reason to NOT generate the checkboxes again. Another reason is that the generation of checkboxes is will freeze the userform for a couple seconds.
Currently I've the following idea to move the checkbox on page2 to page1:
C.Parent.Name = "Page" &VAR_Sub.curMultipage + 1`
However changing the Parent.Name
doesn't seem to move the checkbox to page1.
I"ve confirmed that C.Parent.Name
was Page2 and it has changed to Page1. C is the checkbox.
The code for looping:
For Each C In UserForm1.MultiPage1.Pages(UserForm1.MultiPage1.Value).Controls
`If TypeName(C) = "CheckBox" Then
VAR_Sub.i = VAR_Sub.i + 1
If InStr(1, C.Caption, strSearchTerm, vbTextCompare) = 0 Then
C.Visible = False
Else
C.Visible = True
If Var_Sub.i > 44 Then
chkName = C.Parent.Name
'MsgBox "OLD" & chkName
C.Parent.Name = "Page" & VAR_Sub.curMultiPage + 1
chkName = C.Parent.Name
'MsgBox "NEW" & chkName
End If
''Below more positioning code
....
End If`
Next C
Thanks in advance and kind regards. PS: If my post is lacking something, please give me a heads up. I will improve it.
I try to achieve this: Wanted result
Currently I have achieved the following: Page1 with generated checkboxes Page2 with generated checkboxes Using the filter results into: Page1 after filter Page2 after filter
As you can see in the images above of what I have achieved, the checkboxes are on a different page of a multipage. Even though the parent.name has been changed to Page1
Added pictures of what I"m trying to achieve. Currently I"m trying to achieve the above with a listbox.