+ Reply to Thread
Results 1 to 7 of 7

how to change the color of a macro button based on a sheet being present or not

  1. #1
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    how to change the color of a macro button based on a sheet being present or not

    i have a sheet with 260 macro buttons on it. the buttons are either "Add" or "Del" and basically the add button creates the sheet and populates it with some data, the Del deletes the sheet. the color of the Add button is green and the Del button is red. what i would like to do is have some code that greys out the Add button if the sheet does exist and greys out the Del button if the sheet doesnt exist. i have no code to work with as i dont even know how to program the buttons for this functionality. so is this possible to do?

    here is the Add button for Sheet A
    Please Login or Register  to view this content.
    here is the Del button for Sheet A
    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: how to change the color of a macro button based on a sheet being present or not

    Perhaps something like this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: how to change the color of a macro button based on a sheet being present or not

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  4. #4
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: how to change the color of a macro button based on a sheet being present or not

    thanks AlphaFrog and mehmetcik.

    alphafrog, that is the ticket! works like a champ.

    appreciate all the help.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: how to change the color of a macro button based on a sheet being present or not

    You're welcome.

    Alternatively, you could have one button that toggles its caption and function.

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: how to change the color of a macro button based on a sheet being present or not

    i wish that i had seen this one before i made my 260 buttons, wah! much more elegant and less buttons. i appreciate all your help, i will have to see if i want to redo the page. but thanks again for going the extra mile.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: how to change the color of a macro button based on a sheet being present or not

    You're welcome. Sorry I didn't mention it before. It was an afterthought.

+ 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] Change back ground color of button based on week Number on a userform
    By meabrams in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-20-2015, 06:39 AM
  2. [SOLVED] Make cell change color and add text via BUTTON + MACRO
    By Wise_87 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2015, 12:51 AM
  3. Using Macro to change cell color based on reference cell value in different sheet
    By Emma Ford in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2015, 03:51 AM
  4. Replies: 4
    Last Post: 01-12-2013, 02:42 PM
  5. VBA / Macro help needed to change the barchart color based on Cell Color
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2012, 09:15 AM
  6. [SOLVED] Macro to change multiple sheet tabs color based on a cell value
    By greywu1f in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-19-2012, 10:31 AM
  7. Change Button Color With A Macro?
    By mirtjemirtej in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-27-2009, 04:16 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