+ Reply to Thread
Results 1 to 14 of 14

Conditional Formatting Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Conditional Formatting Macro

    Hello there,

    I am working on a worksheet having 4 segments and each segment has 5 columns in it which are amount received, details requested date, reminder 1, reminder 2, details received . I want a macro that changes the color of these 5 cells (not entire row) based on;

    1. The date is put in details requested date column. (Light green color)
    2. 3 days passed after details requested i.e reminder 1 due and details received column is blank. (Yellow)
    3. Reminder 1 is sent - date of reminder 1 sent (Orange)
    4. 3 days passed of reminder 1 sent and details received column is blank. (Pink)
    5. Reminder 2 is sent - date of reminder 2 sent.(Red)
    6. The color of these cells go white anytime the date is put in details received column.

    I would really appreciate your help.

    Best Regards

    Asif

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,772

    Re: Conditional Formatting Macro

    To provide a macro to do this will require seeing your actual data layout, which data is in which column. It would be best if you attach a file with sample data and examples of colors applied for each of your six rules.

    "I want a macro that changes the color of these 5 cells (not entire row) " This is ambiguous. Do you mean that you want to change all 5 cells of the columns that you listed based on the 6 criteria you list? Or that you want each criterion to apply only to one cell? (you said not the entire row but we don't know what the entire row contains).

    "3. Reminder 1 is sent - date of reminder 1 sent (Orange)" What does this mean? That there is a date in this column, rather than a blank?

    "5. Reminder 2 is sent - date of reminder 2 sent.(Red)" What does this mean? That there is a date in this column, rather than a blank?

    Last of all, this could be done fairly easily with conditional formatting. Why do you want a macro to this?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Conditional Formatting Macro

    I've done this with conditional formatting.

    Attached is an example - I will add some explanation but want to post this before the Forum crashes on me (again!)
    Attached Files Attached Files
    Excel is a constant learning process and it's great to help each other. If any of us have helped you today, a click on the "reputation" star on the left is appreciated.

  4. #4
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Conditional Formatting Macro

    Sorry, every time I try to post a reply I get an error message so am now resorting to attaching a text file with some explanatory notes!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Conditional Formatting Macro

    Dear 6StringJazzer and Shirleyxls,

    Thank you so much for your replies. Below is the detail describing data the conditional formatting I want (whether as macro or simply conditional formatting). I am really sorry I can not upload any sheet from the system (access is denied to upload). I would really appreciate your help.

    Best Regards

    Asif

    Client Name Amount Date Payment Details Requested
    Date Reminder 1 Reminder 2 Details Received Requirements
    20,000.00 10/05/2016 12/05/2016 16/05/2016 - 18/05/2016 The row color should remain white as details are received as mentioned in Column I.
    10,000.00 12/05/2016 14/05/2016 18/05/2016 25/05/2016 - The row color should turn red as despite remiders details not received (No date in Column I)
    5,000.00 16/05/2016 18/05/2016 22/05/2016 - - The row color should turn orange as Remider 2 is due (date when 1st Remider sent + 3 days lapse )
    2,500.00 20/05/2016 22/05/2016 26/05/2016 - - The row color should turn Dark Green as Reminder 1 is sent and Details not received
    18,000.00 22/05/2016 24/05/2016 - - - The row color should turn Light green as Reminder 1 is due ( date when details requested + 3 days lapse) and Details not received as per Column I


    22,000.00 24/05/2016 28/05/2016 30/05/2016 The row color should remain white as details received within due time.

  6. #6
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Conditional Formatting Macro

    Oh sorry, I think its messed up. Its not showing the post properly. I would upload the sheet when I get access to my personal pc. I hope you would tolerate it.

    Best Regards

    Asif

  7. #7
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Conditional Formatting Macro

    Hi Asif,

    When you get back to this and load your file, can you confirm if you want the WHOLE ROW to change colour depending on your rules.

    I tried to modify the sample I sent you but I got a bit confused over the columns (not your fault - it just doesn't display very well in the text ) so I will wait until you're able to load a sample. In the sample you can manually colour things the way you want to see them maybe with some text describing the rules alongside each row, then I can be sure I've got it.

    Shirley

  8. #8
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Conditional Formatting Macro

    Please find attached the sheet with all descriptions. just want to highlight the row or cells containing the data only.
    Dear shirleyxls, I also have tried to do conditional formatting using your formula but it only takes 3 conditions while i want 5 conditions for the same set of cells so it overrides the others.

    Best Regards
    Asif
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Conditional Formatting Macro

    Ah sorry Asif - I only just noticed that you are using Excel 2003 which has much more limited conditional formatting than later versions. I vaguely remember doing something in VBA for this. I will see what I can find but I may struggle to test it as I no longer have a copy of 2003.

  10. #10
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Conditional Formatting Macro

    Dear shirleyxls,

    No I am using Microsoft Office 2013 (Professional Plus). I think the file is saved in 2003 format. But I think VBA macro would be a good option as conditional formatting is not allowing me to use more than 3 conditions. Thanks for your support.

    Best Regards

    Asif Shabbir

  11. #11
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,772

    Re: Conditional Formatting Macro

    Quote Originally Posted by AsifShabbir View Post
    No I am using Microsoft Office 2013 (Professional Plus). I think the file is saved in 2003 format.
    The file is saved in the format for Excel 2007 and later. However, your forum profile says you are using Excel 2003, so we thought you were just converting the file to .xlsx format from .xls. If you are using 2013 please update your forum profile so we don't spin our wheels.

  12. #12
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Conditional Formatting Macro

    Hi Asif,

    If you are running Office 2013 you are definitely NOT limited to 3 conditions on CF. In my opinion, it's always better to use the tools which Excel makes available where possible, rather than writing VBA code.

    I've updated your test file with the CF rules which meet the criteria you described. I changed a few dates just to make sure it was all working as I thought it should, but you should test it thoroughly before applying to your live data. You will probably need to change the CF Applies to ranges.

    As mentioned above, please could you make sure you update your profile to 2013 version - you're much more likely to get responses from a wide range of people
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Conditional Formatting Macro

    Dear shirleyxls,

    It is working perfectly. Thank you so much for your help. It really eased my task.

    Best Regards

    Asif

  14. #14
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Conditional Formatting Macro

    Glad it worked for you.

    Don't forget to change your MS Office version in your profile

+ 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. Macro to set up conditional message based on results of conditional formatting
    By paysola in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-04-2016, 12:38 AM
  2. help with conditional formatting macro
    By MATT.B in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-17-2016, 06:17 PM
  3. Macro for formatting fonts and cell colours - not Conditional Formatting
    By Kayaness in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-07-2011, 03:46 AM
  4. Conditional formatting macro..??
    By iaingear in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-21-2009, 03:08 AM
  5. Conditional formatting using a macro.
    By Jay3 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-30-2008, 08:09 PM
  6. Conditional Formatting Using a Macro
    By Jay3 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-30-2008, 12:00 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