LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default "Renaming Form Buttons From Macro"

Hi Gang,

Here's what I've got so far.....I created a test wb and form with three
commandbuttons.....I wish to rename these buttons periodically (only the
caption, not the underlying code), using the contents of cells in Col A. The
msgbox indicates it's stepping through code correctly but, so far, I can only
get it to rename CommandButton1. I've tried all I can think of to get the
code to step through the commandbuttons but so far, nothing works for me.

Private Sub UserForm_Activate()
Dim M As String
Dim A As String

For N = 1 To 3
M = "CommandButton" & N
A = Range("a" & N).Text
MsgBox M
' Me.M.Caption = A<<this didn't work as well as various tries at &
statements.
Me.CommandButton1.Caption = A '<<< this of course only renamed CB1
Next N

End Sub

And and all help here would be greatly appreciated.

TIA,

Don
 
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
2007 Need macro to auto set option buttons all to "Yes" or "No" Paula Excel Worksheet Functions 1 October 20th 09 08:07 PM
function to return day in the form "Monday", "Tuesday" etc given . MTro Excel Worksheet Functions 2 October 3rd 07 09:49 AM
Shortcut key for "Paste Options" and "Error Checking" buttons? johndog Excel Discussion (Misc queries) 1 October 6th 06 11:56 AM
Standard "Open" and "Save As" Buttons Paulo de Arruda Borelli[_2_] Excel Programming 2 September 2nd 04 06:59 AM
Assigning Macro to "Buttons" grin2000[_5_] Excel Programming 2 June 9th 04 02:53 PM


All times are GMT +1. The time now is 07:39 PM.

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

About Us

"It's about Microsoft Excel"