Link to home
Start Free TrialLog in
Avatar of Theva
ThevaFlag for Malaysia

asked on

Sort data according to date and time

Hi Experts,

I would like to request Experts help create a macro to sort data at Column D. The nearest date and time need to be at top of the column and highlight the row (Range A:I) with red  color if the date at column D is less than 3 days (compare with current date) automatically. Hope Expert will help me to create this feature.

I have attached the workbook for Experts perusal.


SortDate.xls
SOLUTION
Avatar of Ardhendu Sarangi
Ardhendu Sarangi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW, what time zone do u work from... u seems to be on all the time :)
Why do you need a macro?  You can simply sort on the date column?

Also a simple conditional format would change the color.

I have attached an image to show you the conditional format
 User generated image
Avatar of Theva

ASKER

Hi pari123,

Thanks for the code. Perhaps my Explanation could create confusion, sorry for that. Managed to sort for date sorting, by right should "Order:=xlAscending", but not sure how to modify <3days. We have buffer 3 days, if the date crossed this 3 days rules than we need to highlight.  e.g. today (17-Nov), therefore if there is  data at cell between 18 - 20, need to highlight, ignore other date (20 >). Hope its clear.

P/s: I'm GMT+8 time actually.  
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Theva

ASKER

Hi Tommy,

No date being highlighted. How to code "Now() + 3 day" highlight the data. If more than 3 days ignore.

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Theva

ASKER

Hi,
Thanks for the great help.