Results 1 to 4 of 4

[SOLVED] VBA Changing button.caption with the same Button.Name

Threaded View

mcmunoz [SOLVED] VBA Changing... 09-26-2013, 09:31 PM
Andy Pope Re: VBA Changing... 09-27-2013, 03:39 AM
mcmunoz Re: VBA Changing... 09-27-2013, 04:49 AM
Andy Pope Re: [SOLVED] VBA Changing... 09-27-2013, 04:58 AM
  1. #1
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

    [SOLVED] VBA Changing button.caption with the same Button.Name

    I have a problem with my code. There is an error written as BOLD characters in the code section.

    I have a sheet that I want to change all of my button.caption named btn1, btn2, btn3, btn4, btn5...... so on and so for at least 49 buttons.

    Sub ClearAllButtonClick()
     
    Dim btn
    
    If MsgBox("Are you sure you want to clear all check mark?", vbExclamation + vbYesNo, "Uncheck All") = vbNo Then Exit Sub
    
    For Each btn In ActiveSheet.Shapes
        If btn.Name Like "btn*" Then btn.Caption = "UNCHECK ALL" '->ERROR I want to change.
    Next btn
    
    MsgBox "All check mark are cleared.", vbInformation, "Uncheck All"
    
    End Sub
    P.S: Developer Tab -> Form Control -> Button
    Last edited by mcmunoz; 09-27-2013 at 04:50 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Changing the Caption of an Option button in a userform using vba
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-10-2012, 12:11 PM
  2. [SOLVED] Is it possible to do a comm.button with scrolling caption /changing caption?
    By Lkivagten in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2012, 08:10 AM
  3. Changing Command Button Caption with userform Open
    By andrew c. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2011, 08:09 PM
  4. Changing the caption of a Command Button
    By Colin M in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2007, 12:24 PM
  5. [SOLVED] changing the caption of a command button
    By JWCrosby in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2005, 04:15 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1