hi all i need a macro which will compare velues in 2 cells
example if Cell A1 = 13:00 and B1 = 12:57 than
cell C1 = color green
please create a code for the above situation
hi all i need a macro which will compare velues in 2 cells
example if Cell A1 = 13:00 and B1 = 12:57 than
cell C1 = color green
please create a code for the above situation
Hello kshitij_dch,
Below is a code that should accomplish what you are trying to do. Place it in the worksheet it is meant for under the Worksheet_Change event.
Just a note, if your values are formatted like 13:00, I needed to set the cell's number format to text to get the code to work correctly.
Also the code only works if after you enter in a value into column B you hit the enter key. If you hit tab it will not work correctly. Please let me know if you would prefer to hit tab and I can adjust the code for you.
![]()
Please Login or Register to view this content.
thankyou for the replyi tell you the whole procedure , i have date in 24 hours format
from 1 to 24 ....i need a macro which will check value in a column A compares with column B than after comparision result will be in column C
column a 13:00 , column b 12:57
column a 15:30 , column b 15:03
that means it is acceptable for macro while checking 3 minutes prior and 3 minutes after the specified time in colum a . colour gets green in column c otherwise if above condition didnt meet color gets red in column c
column A1 is 13:00 and column b1 is 12:57 column c will be green
column a2 is 15:30 and column c1 is 15:32 column c will be green
You do not need a macro for that. In the cells in column C, you are supposed to use a subtraction formula for to get the difference between the two times. Then you use conditional formatting on column C. Apply two conditions: One for the condition that the difference is less than or equal three minutes and one if otherwise. If you respond, please upload a workbook with your efforts if you can't get it to work.
Ben Van Johnson
work book attached for your reference , i d cell i have written the condition upon which macro will run
Welcome to the Forum, unfortunately:
This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.
Thread Closed.
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]
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks