+ Reply to Thread
Results 1 to 9 of 9

Macro to color highlight dates in certain range. Please help.

  1. #1
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Macro to color highlight dates in certain range. Please help.

    Hi. Just few words from me before I will go to the problem as its my first post on these forums. If you want to go straight to helping just skip the first paragraph.

    I'm a guy who is generally good with computers but not with hardcore coding. Though if I usually look codes that others have created I then I will understand most of it. I normally prefer to search and search to find my answers rather than asking the same questions that have been asked before. But I got new job now with very limited spare time and I need bit of help. It my first job with actual need for good computer and excel knowledge. I'm now a vendor controller. I would like to do my best to keep this job as the colleagues are very nice Anyway, I will ask help bit by bit in these forums so I can close the threads and mark them solved so others will know it solved my problem and might help them as well. I already see that my job could be a lot less stressful and I can reduce big amount of workload by simply creating some macros. The ones that I can figure out with record macro i will do myself. I just need help with rest of them.

    What I need is a macro that would highlight some range of dates in red and some in orange in certain column or columns. We normally work with our data from Friday to Friday.
    Let me explain the the ones I need highlighted in red first. I want the macro to highlight all the dates in column U that are in past using the date in cell Z2, for example lets say the date is 28/01/2011. So I want the macro to see the date in Z2 and highlight every date in column U that is before 28/01/2011 (28th inclusive).

    Now I would like to have a macro that will highlight some dates in orange. I want the macro to highlight all the dates again in column U that are in 6 days reach using the date in cell AA2, for example lets say the date is 29/01/2011. So I want the macro to see the date in AA2 and highlight every date in column U that is from 29/01/2011 (29th inclusive) to the next 6 days (effectively to the 04/02/2011 inlcusive).

    So if I would arrange the dates ascending in column U they would all be highlighted in red till 28th inclusive (Friday), then from 29th (Saturday) onwards till 4th of Feb (inclusive) they would be highlighted in orange. Rest of the dates should remain as normal.

    I will attach the excel sheet that is in format I would be actually using. It gives an easy way to test the recommended macro to see if its working. I have deleted some info on some columns so my employer wouldn't mind me uploading it.

    I would love to have these 2 macros separately as I will be easier for me to study the code and learn from it.

    I hope someone can help me as Im very desperate to get them as quickly as possible to make reduce my workload as there is so much data I need to manipulate and analyze. This would really help me.


    Best regards,
    Rain
    Attached Files Attached Files
    Last edited by rain4u; 01-29-2011 at 09:57 AM.

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Macro to color highlight dates in certain range. Please help.

    Are you sure you want a macro. Conditional Formatting feature will take care of your requirements.

  3. #3
    Valued Forum Contributor jwright650's Avatar
    Join Date
    12-10-2010
    Location
    Va, USA
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    606

    Re: Macro to color highlight dates in certain range. Please help.

    Quote Originally Posted by Cutter View Post
    Are you sure you want a macro. Conditional Formatting feature will take care of your requirements.
    Correct. See attached<---sorry, it won't let me attach the corrected workbook for some reason
    Last edited by jwright650; 01-29-2011 at 08:27 AM. Reason: added comment
    Life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
    John Wright

  4. #4
    Valued Forum Contributor jwright650's Avatar
    Join Date
    12-10-2010
    Location
    Va, USA
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    606

    Re: Macro to color highlight dates in certain range. Please help.

    send me an email, and I will send the corrected workbook...something has goofed up with the uploading software, it says that I do not have permission to access this page.

    jwright650atAOL.com

  5. #5
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: Macro to color highlight dates in certain range. Please help.

    Quote Originally Posted by jwright650 View Post
    Correct. See attached<---sorry, it won't let me attach the corrected workbook for some reason
    I had same problem for some reason. Couldn't upload unless I zipped it. I'm not very familiar with conditional formating.

    But its SAP (MRP program) that generates these reports and you can save them in xls. So I will have a raw data like that I have to start to manipulate. Currently people at work will arrange the columns, use their judgment and then highlight certain ranges in red, orange and green. etc. And then it gives you overall picture and you have to sort out some problems with some parts, suppliers etc.

    I'm pretty sure its macros what I'm after. I would appreciate the help.


    Cheers

  6. #6
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: Macro to color highlight dates in certain range. Please help.

    Quote Originally Posted by jwright650 View Post
    Correct. See attached<---sorry, it won't let me attach the corrected workbook for some reason
    Thx for emailing me the xls. Its spot on as far as the result. But can I achieve the same result with macro? The result is excatly what i needed.

  7. #7
    Valued Forum Contributor jwright650's Avatar
    Join Date
    12-10-2010
    Location
    Va, USA
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    606

    Re: Macro to color highlight dates in certain range. Please help.

    Here is what I did to your file in Column U based on a date in Z2

    http://www.datapigtechnologies.com/f...rmatexcel.html

  8. #8
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: Macro to color highlight dates in certain range. Please help.

    Thank you for everyone. I think I got it. Will play around with it for a little bit. Wont SOLVED the thread yet, as might have a question or two regards the matter. Will put it SOLVED after that.
    Will have to start a thread regards another thing with dates.


    Cheers this is brilliant!

  9. #9
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: Macro to color highlight dates in certain range. Please help.

    The right answer to this kind of request is indeed Conditional Formating. Though You can record it as a macro when going through the progress if desired. Also the link that John Wright provided:

    Quote Originally Posted by jwright650 View Post
    Here is what I did to your file in Column U based on a date in Z2

    http://www.datapigtechnologies.com/f...rmatexcel.html
    is extremely helpful to understand the whole concept of conditional formating.

    Thanks again to everyone. Will put SOLVED to this thread, that is if I figure out how to do that.

    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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