adding userform command buttons

G

Guest

Hi,

I want to for subroutine1 to add 5 commandbuttons to userform1 and when
clicked, the commandbuttons will call another subroutine2. This is what I
currently have to create the 5 commandbuttons. When clicked, the
commandbuttons do nothing.

sub subroutine1

for i=1 to 5
With UserForm1
For i = 1 To 3
Set Mycmd = .Controls.Add("Forms.CommandButton.1")
Mycmd.Left = 0
Mycmd.Top = 100 * i
Mycmd.Width = 175
Mycmd.Height = 20
Next i
UserForm1.Show
End With

end sub

Thanks for you help!
 
G

Guest

You are right about my strange code. But your suggestion really helped.
Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top