+ Reply to Thread
Results 1 to 7 of 7

i need a macro code to compare time in two cells cell A and cell b

  1. #1
    Registered User
    Join Date
    03-07-2012
    Location
    jaipur
    MS-Off Ver
    Excel 2007
    Posts
    50

    i need a macro code to compare time in two cells cell A and cell b

    i need a macro code to compare time in two cells cell A and cell b

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: i need a macro code to compare time in two cells cell A and cell b

    kshitij_dch,

    I'm not exactly sure what you're looking for, but this should get you started:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    03-07-2012
    Location
    jaipur
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: i need a macro code to compare time in two cells cell A and cell b

    i have to compare cell A time with cell B time suppose cell a time is 13:00 and cell b tome is 12:57 , above situation is ok C1 gets green color else red

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: i need a macro code to compare time in two cells cell A and cell b

    kshitij_dch,

    What you're looking for can be accomplished with conditional formatting. Attached is an example workbook showing how it works. The conditional format formulas applied to column C are:

    Atime is less than Btime, highlight column C as red:
    =AND(COUNT($A1:$B1)=2,MOD($A1,1)<MOD($B1,1))


    Atime is greater than Btime, highlight column C as green:
    =AND(COUNT($A1:$B1)=2,MOD($A1,1)>MOD($B1,1))
    Attached Files Attached Files

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: i need a macro code to compare time in two cells cell A and cell b

    Kshitij,

    You have opened the same thread 7 times and this is duplication of efforts. If you need help and you are not receiving the responses, you can bump the same thread for a response. Do not create multiple threads for the same issue.

    The next time such a thing happens, you will get another infraction.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  6. #6
    Registered User
    Join Date
    03-07-2012
    Location
    jaipur
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: i need a macro code to compare time in two cells cell A and cell b

    hi thanks for the reply , is this possible to do with macro ???

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: i need a macro code to compare time in two cells cell A and cell b

    Kshitij,

    You have already received some replies. Please check them and let us know if its working for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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