+ Reply to Thread
Results 1 to 7 of 7

USing VBA to highlight cells between dates

  1. #1
    Registered User
    Join Date
    12-14-2016
    Location
    Hong Kong
    MS-Off Ver
    2010
    Posts
    3

    Lightbulb USing VBA to highlight cells between dates

    Hello,
    I'm new to VBA and I need help.
    Is there a way to use VBA to highlight the days from column "G" and "BRL" that are between the start and end dates? (column "E" and "F" respectively)
    I have done an example on the first row in the attachment.
    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: USing VBA to highlight cells between dates

    Hello cthamas
    First format range("G1:BRL1") as dates and the same for columns E & F to make it work
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Registered User
    Join Date
    12-14-2016
    Location
    Hong Kong
    MS-Off Ver
    2010
    Posts
    3

    Re: USing VBA to highlight cells between dates

    Hi Yasser! Thanks for the reply
    However that code doesn't seem to work for me :/
    Do I have to edit the code in any way?

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: USing VBA to highlight cells between dates

    Have you changed the format of dates in G1:BRL1 and in columns E & F ?

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: USing VBA to highlight cells between dates

    Try this version
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-14-2016
    Location
    Hong Kong
    MS-Off Ver
    2010
    Posts
    3

    Re: USing VBA to highlight cells between dates

    Yes it has worked!
    Thank you so much (:
    I wonder if there is a way to make the code run automatically once the dates are filled in?

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: USing VBA to highlight cells between dates

    Yes you can add a code in worksheet change.. When typing dates in column E & F, the code will trigger.. But personally I prefer to finish entering data then run the code once

+ 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] How Can I: Highlight a Range of Cells Based on Dates?
    By Sandcastle in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-12-2016, 05:55 PM
  2. [SOLVED] How do I highlight cells that do not contain valid dates.
    By AndyRoo119 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-09-2015, 09:04 AM
  3. [SOLVED] Highlight cells between two dates
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2015, 05:05 AM
  4. [SOLVED] Help with Macro to highlight cells between dates
    By Slomaro2000 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-27-2015, 03:29 PM
  5. [SOLVED] Highlight Cells Based on Dates
    By pugsly8422 in forum Excel General
    Replies: 3
    Last Post: 01-27-2015, 01:09 PM
  6. [SOLVED] Trying to get Excel to highlight cells based on assigned dates.
    By tatumrae in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-10-2013, 08:25 PM
  7. [SOLVED] automatically highlight cells with expired dates?!
    By cwest123456 in forum Excel General
    Replies: 2
    Last Post: 08-01-2005, 02:05 PM

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