***robotics date macro - 1***

rohitw2

New Member
Joined
Mar 24, 2017
Messages
9
Hi, I need a macro/vba code which can calculate the Age calculation. I mean it must calculate current date minus the different pay date in column d to column c. As i have to do it manaually on daily basis so i want to do it automatically the moment i paste the new pay dates in column d.

Please Help me!!!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I'm not completely sure I understand you. Would you care to give us an example of the data in columns C and D, and what you want the result to be for a given date?

Hopefully you're aware that dates just represent the number of days since 1/1/1900 - so for example today is 42790 - and you can do simple arithmetic with them such as adding a number of days to a date to find a date in the future or subtracting one date from another to find the number of days between them?
 
Upvote 0
Suppose i have 3 column b, c and d. I have different dates in column b which i have manually added. what i want is, a macro should update the today's date in column c and do the age calculation(Today's date minus the other date i have in column b) in column d automatically.:confused:
 
Upvote 0
say you put in A1 = Now() that will always update to the latest value,, then in B1 is the date you are interested in, then in C1 your output which is =$A$1-B1 and format as you wish to see . You can drag C1 down, and A1 is always your reference
 
Upvote 0
Thanks for this. But i want this in coding rather than using the excel formula in a sheet for at least calculating the age in column d.:confused:
 
Upvote 0
[FONT=&quot]Thanks for this. I know to do this manually in excel but [/FONT][FONT=&quot]i[/FONT][FONT=&quot] want this in coding rather than using the excel formula in a sheet for [/FONT][FONT=&quot]at least[/FONT][FONT=&quot] calculating the age in column d.[/FONT]:confused:
 
Upvote 0
[FONT="]Thanks for this. I know to do this manually in excel but [/FONT][FONT="]i[/FONT][FONT="] want this in coding rather than using the excel formula in a sheet for [/FONT][FONT="]at least[/FONT][FONT="] calculating the age in column d.[/FONT]:confused:

Hmm, you still haven't stated why you want it in code but...

To start with a macro doesn't automatically update, it needs something to trigger it and so you need to tell us what is going to trigger it i.e. a selection change, a worksheet change, the workbook opening, a double click etc.

You also need to state how you want the age to appear.

Btw the formulas do automatically update.
 
Upvote 0
It really would help if you could give us an example of the dates in columns B, C and D, and what you want the result to be for a given date.
 
Upvote 0
or, as you can do formulas, why not do that and then record with the macro recorder
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top