+ Reply to Thread
Results 1 to 13 of 13

Highlight current time with CF

  1. #1
    Registered User
    Join Date
    06-01-2015
    Location
    SP
    MS-Off Ver
    2018
    Posts
    25

    Exclamation Highlight current time with CF

    Hello, I need a help.

    I have a column with hours:

    0:00
    1:00
    2:00
    3:00
    4:00
    5:00
    6:00
    7:00
    8:00
    9:00
    10:00
    11:00
    12:00
    13:00
    14:00
    15:00
    16:00
    17:00
    18:00
    19:00
    20:00
    21:00
    22:00
    23:00

    How can I highlight the cel that represent current time? I've tried everything...

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Highlight current time with CF

    Try this...

    Let's assume the data is in the range A2:A25

    Select the *entire* range A2:A25 starting from cell A2.
    Cell A2 will be the active cell. The active cell is the
    one cell in the selected range that is not shaded. The
    formula will be relative to the active cell.

    Goto the Home tab>Styles>Conditional Formatting>
    Manage rules>New rule>Use a formula to determine
    which cells to format

    Enter this formula in the box below:

    =HOUR(A2)=HOUR(NOW())

    Click the Format button
    Select the desired style(s)
    OK out
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Highlight current time with CF

    Hi and welcome to the forum

    Use a Conditional Format. e.g.

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

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    06-01-2015
    Location
    SP
    MS-Off Ver
    2018
    Posts
    25

    Re: Highlight current time with CF

    How can I extend to others cells of the same line?

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Highlight current time with CF

    Go to Conditional Formatting, Manage Rules, select the rule for the time and where it says APPLIES TO change the reference to include the column that you want the highlight to extend to.

    Amend the rule to be =HOUR($A2)=HOUR(NOW())

    Eg $A$1:$C$25 would extend the formatting to column C
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Registered User
    Join Date
    06-01-2015
    Location
    SP
    MS-Off Ver
    2018
    Posts
    25

    Talking Re: Highlight current time with CF

    Thank you so much!

    You're the man!

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Highlight current time with CF

    It dawned on me that this may not work as you anticipated.

    If you open the file at say 9:58 AM then the row that corresponds to 9:00 will be highlighted.

    If you still have the file open at say 10:01 AM the row that corresponds to 9:00 may still be highlighted.

    This is because the formula will not automatically update until some event causes a calculation to take place (assuming you have calculation set to automatic).

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Highlight current time with CF

    I wonder if there is some kind of VBA counter that could cause an "event" every couple of minutes to keep the correct time formatted.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Highlight current time with CF

    There is. It's called OnTime.

    You would set a timer and every x interval the OnTime event can trigger a calculation.

    Just don't ask me how to program it!

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Highlight current time with CF

    It doesn't look to be a simple task, at least for me

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Highlight current time with CF

    Either that, or instead of using conditional formatting and a calculation event, the formatting could be applied directly with the OnTime event.

  12. #12
    Registered User
    Join Date
    02-09-2018
    Location
    London, Englandd
    MS-Off Ver
    2010
    Posts
    12

    Re: Highlight current time with CF

    Hi There,

    I am stuck with a similar problem. I have a schedule over the course of the day from 04:30 - 01:45 (next day). Time is going in 15 min blocks i.e. 10:00; 10:15; 10:30; 11:00....etc.

    I would like a single red line to automatically move along the appropriate cell as the day goes along. I have manually created what it is roughly that I want, with cell B5 showing the current time using the =NOW() formula.

    There is a formula that does one for days (not minutes) with the formula (assuming cell D4 is the first cell of the days)
    =IF(D$4=TODAY(), TRUE, FALSE)
    This works perfectly - I can format for there to be just one single red line and it goes far down the spreadsheet - up until where I had highlighted.

    But I want this to be every 15 minutes. Not even hourly.

    When I tried the formula earlier =HOUR(A2)=HOUR(NOW()) this was close, but it showed 3 red lines as it was covering over the course of the hour, understandably. Also, the red line would only cover the length of the single time cell - I wanted the line to extend downwards (like in the attached image).

    Is there a formula I can use that will mark one long line for every 15 minutes?
    Conditional Formatting 15 MINS.JPG
    Thank you!
    Last edited by empri; 02-09-2018 at 08:25 AM.

  13. #13
    Registered User
    Join Date
    02-09-2018
    Location
    London, Englandd
    MS-Off Ver
    2010
    Posts
    12

    Re: Highlight current time with CF

    Sorry - I have now created my own thread on this and didn't know how to delete my earlier question!

    Please see https://www.excelforum.com/excel-for...ml#post4839894 if you're interested!

    Thanks

+ 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. Code to insert current date (but NOT current time)
    By mjwillyone in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-13-2013, 09:37 AM
  2. [SOLVED] add current time (hh:mm:ss) as well as current date (dd:mm:yyyy) into the code
    By papasideris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2012, 02:29 PM
  3. [SOLVED] highlight the current cell
    By D in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-02-2006, 07:25 AM
  4. [SOLVED] Can I automatically enter the current date or current time into a
    By Ben in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 10-19-2005, 11:05 AM
  5. [SOLVED] How do I highlight the current cell?
    By psilzle in forum Excel General
    Replies: 2
    Last Post: 08-25-2005, 03: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