+ Reply to Thread
Results 1 to 3 of 3

Button caption changing depending on macro and current state

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    96

    Button caption changing depending on macro and current state

    Been playing around with this code for an hr now and cant get my head around it, The code works however when you start out, the button is already called Anounced but does not run the macro untill you click it to do Unanounced and then click it back a second time to display anounced and run that coresponding macro.

    Is there a way to:

    a) Make it run atleast once which ever state the button is in? caption "Anounced" or Caption "Unannounced" so that atleast once when file is loaded it will run so caption shown will have atleast had that macro ran atleast once?

    And

    b) add a type of start caption, (3rd caption) for example "SELECT" which if a) is working would run Macro3 "SELECT" atleast once on load up and allow the "Anounced" and "Unanounced" to be selected?


    (this code was borrowed from somebody else but i can not recall which post it was from as visited lots of sites)


    Please Login or Register  to view this content.

    any help appreciated.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Button caption changing depending on macro and current state

    Hi Darkprophecy,

    How about doing an event macro behind the Worksheet Activate event? Something like:
    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    08-27-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    96

    Re: Button caption changing depending on macro and current state

    Quote Originally Posted by MarvinP View Post
    Hi Darkprophecy,

    How about doing an event macro behind the Worksheet Activate event? Something like:
    Please Login or Register  to view this content.

    I dont know how these work a snever used them before.

    No sure how to implement this?

    essentialy i have a button and i press it to run macro to enter some text in a cell if i press it again it enters difrent text in the same cell.
    When 1st opening the book the caption for the 1st macro is diplayed but without having run that macro call function for the 1st time.

    to get the macro to call i have to cycle through button captions because on loading its a blank cell. (this is why i was wondering if its possible to have a 3rd caption added to this code also. or even just ensure that on loading book it runs by default the macro assigned to the caption atleast once on load up.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA Changing button.caption with the same Button.Name
    By mcmunoz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-27-2013, 04:58 AM
  2. [SOLVED] VBA Changing button.caption in a specific cell column
    By mcmunoz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-26-2013, 09:14 PM
  3. [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
  4. [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
  5. 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
  6. 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
  7. [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
  8. Change caption on a macro button
    By gbeard in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-21-2005, 09:06 AM

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