Regardless of how you get the arbitrary form name, once you have the
form name in a String variable, you can use code like
Dim FormName As String
' get an arbitrary form name somehow, e.g.,
FormName = "UserForm2"
With VBA.UserForms
.Add FormName
.Item(.Count - 1).Show
End With
Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
On Fri, 14 May 2010 17:22:01 -0700, Rock
<(E-Mail Removed)> wrote:
>I have 9 different UserForms and I can call any specific UserForm with the
>macro below. (Imagine any number where the question mark is)
>
>Sub ShowUserForm()
>UserForm?.Show
>End Sub
>
>What I would like to do instead is have a macro that will call a different
>random UserForm from this list below each time I activate it.
>
>UserForm1
>UserForm2
>UserForm3
>UserForm4
>UserForm5
>UserForm6
>UserForm7
>UserForm8
>UserForm9
>
>Can you help?