+ Reply to Thread
Results 1 to 11 of 11

Macro for alternate color based on cell value

  1. #1
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Macro for alternate color based on cell value

    Dear Experts,

    Please find here attached workbook, i have used macro to hide the row if column H, J & L is 0 by using command button. I am looking for macros for color the alternate rows in both the situations when hiding the rows or not for column B, D, F, H, J & L.

    Thank you for your precious phase and treasurable expertise.

    Many Regards,

    Neilesh
    Attached Files Attached Files

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

    Re: Macro for alternate color based on cell value

    You do not need a macro for this.

    Use one or two conditional formats.

    Select B8 to L28

    Click on Home and then conditional format

    Select new rule and then use a formula.

    Paste this into your formula box and then select format and fill and select a colour.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If you feel you need a second colour then:


    Select B8 to L28

    Click on Home and then conditional format

    Select new rule and then use a formula.

    Paste this into your formula box and then select format and fill and select another colour.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 08-07-2017 at 01:08 PM.
    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.

  3. #3
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro for alternate color based on cell value

    Thank you so much dear Expert. Perfect Solution. Really appreciated your expertise.

    Many Regards,

    Neilesh
    Last edited by AliGW; 08-08-2017 at 07:19 AM. Reason: Unnecessary quotation removed.

  4. #4
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro for alternate color based on cell value

    Dear Expert,

    Please find here attached workbook with the provided solution. Dear Expert, I found an error while applying the provided formula in the conditional formatting, i.e. after hiding the blank rows with 0 values the color to the next is not getting change. Request to you please do help me on the same.

    Many thanks and kind Regards,

    Neilesh
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Macro for alternate color based on cell value

    Neilesh - please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro for alternate color based on cell value

    Certainly Expert, I will take care henceforth.

  7. #7
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro for alternate color based on cell value

    Dear Expert,

    Please find here attached workbook with the provided solution. Dear Expert, I found an error while applying the provided formula in the conditional formatting, i.e. after hiding the blank rows with 0 values the color to the next is not getting change. Request to you please do help me on the same.

    Many thanks and kind Regards,

    Neilesh
    Attached Files Attached Files

  8. #8
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro for alternate color based on cell value

    Dear Experts,

    Request to you please do provide your expertise on my thread. Your precious phase and valuable support would be appreciated.

    Many Regards,

    Neilesh

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

    Re: Macro for alternate color based on cell value

    Now you have a problem.

    Conditional formatting cannot recognise when a row is hidden.

    So use a hidden column to store a series of numbers that Conditional formatting will recognise.

    *********************************************************************************

    I have inserted a new column A. This column can be hidden or the text colour can be set to white.

    *********************************************************************************


    I have modified the conditional format formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Set it to apply to range $C$8:$M$200

    I have modified your macro:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 08-09-2017 at 02:16 PM.

  10. #10
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro for alternate color based on cell value

    Dear Expert,

    Can you please do provide solution on the same if you can please either by conditional formatting or by macro. Please do help me out.

    Many Regards,

    Neilesh

  11. #11
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro for alternate color based on cell value

    Thank you so much Sir, It worked perfect the way i was expecting. Many Thanks and kind regards,

    Neilesh

+ 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. Replies: 24
    Last Post: 04-12-2017, 03:39 AM
  2. Macro to change cell text color based on darkness of cell fill color
    By cincyshirm61 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-25-2014, 12:11 PM
  3. need macro make color filter based on given color in cell
    By nareshkt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2014, 04:48 PM
  4. [SOLVED] Fill cells with alternate color every time cell value changes
    By danex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-03-2013, 12:19 AM
  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. Replies: 3
    Last Post: 04-30-2012, 04:43 PM
  7. Excel to alternate window based program macro ...
    By H-Man3 in forum Excel General
    Replies: 0
    Last Post: 02-09-2012, 09:36 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