Results 1 to 10 of 10

Thread: Programmatically format VBA buttons

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    Quote Originally Posted by Belleye View Post
    Thanks for your reply, correct me if I'm wrong but the above code references the buttons by which order they where created in? I was hoping to reference the buttons by name, is this possible?
    You can use the Controls collection to address a control direcly by name as well...

    Code:
    X = 2
    Me.Controls("CommandButton" & X).BackColor = vbRed
    So X could be the variable used as a For..Next loop counter as you seem to want.
    Last edited by Rick Rothstein; 09-21-2012 at 02:09 PM.

Similar Threads

  1. Replies: 5
    Last Post: 04-18-2013, 02:30 AM
  2. Clearing UsedRange Of WorkSheet Programmatically
    By tfurnivall in forum Excel Help
    Replies: 1
    Last Post: 12-04-2012, 09:05 AM
  3. HP Calculator Buttons
    By Howardc in forum Word Help
    Replies: 0
    Last Post: 12-01-2012, 11:12 AM
  4. Add ribbon programmatically to Excel 2010 using VBA
    By heapifyman in forum Excel Ribbon and Add-Ins
    Replies: 6
    Last Post: 07-18-2011, 09:16 PM
  5. Social Network Buttons
    By Excel Fox in forum Den Of The Fox
    Replies: 1
    Last Post: 07-10-2011, 10:15 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •