How do I load every UserForm without having to call .Show individually?

Posted by Daniel Cook on Stack Overflow See other posts from Stack Overflow or by Daniel Cook
Published on 2012-12-20T05:00:42Z Indexed on 2012/12/20 5:03 UTC
Read the original article Hit count: 152

Filed under:
|

I wanted to figure out how you could load every UserForm without having to call Userform1.Show UserForm2.Show etc. This was inspired by comments on this answer: Excel VBA UserForm_Initialize() in Module.

I found this method suggested in a few places:

Sub OpenAllUserForms()
    Dim uf As UserForm
    For Each uf In UserForms
        uf.Show
    Next
End Sub

However, no Userforms display regardless of how many are attached to the workbook. When I stepped through the code I determined that the UserForms collection is empty!

How can I load each Userform without having to explicitly show each one?

© Stack Overflow or respective owner

Related posts about excel-vba

Related posts about userform