Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default adding userform command buttons

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!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default adding userform command buttons

Hi borg

goto
http://www.contextures.com/xlUserForm01.html and here you will
learn to Create a Userform

Regads Yngve

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default adding userform command buttons

Your code seems rather strange as it has two control variables with the same
name

Anyway, take a look at http://j-walk.com/ss/excel/tips/modGetOption.bas

borg wrote:
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!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default adding userform command buttons

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

"Paul Lautman" wrote:

Your code seems rather strange as it has two control variables with the same
name

Anyway, take a look at http://j-walk.com/ss/excel/tips/modGetOption.bas

borg wrote:
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!





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Buttons Wilco Excel Discussion (Misc queries) 0 January 13th 11 10:35 AM
Command buttons aussiegirlone Excel Discussion (Misc queries) 2 January 8th 09 09:09 AM
Command buttons Russell Stevenson Excel Programming 3 November 12th 03 02:57 AM
Control Buttons vs. Command Buttons Robert Gibson Excel Programming 1 October 13th 03 04:33 PM
Dynamically Adding Code to Buttons on an existing UserForm Peter Street Excel Programming 2 September 29th 03 09:54 AM


All times are GMT +1. The time now is 08:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"