I am trying to create a macro to loop through a column (column A) with a persons dob and output their age in (column B). I have a basic formula that already calculate the age:
=DATEDIF(Y2,TODAY(),"y").
I have got an example of a loop (calulates average) to do this but im unsure of how to add my formula to it:
Code:Sub calculateAge() Do ActiveCell.FormulaR1C1 = "=Average(RC[-1],RC[-2])" ActiveCell.Offset(1, 0).Select Loop Until IsEmpty(ActiveCell.Offset(0, 1)) End Sub
Can anyone help?
Last edited by PRodgers; 06-09-2009 at 09:34 AM.
Please take a couple of minutes and read ALL theForum Rules then wrap your VBA code (Rule 3)
Please Read Forum Rules Before Posting
Wrap VBA code by selecting the code and clicking the # icon or Read This
How To Cross Post politely
Top Excel links for beginners to Experts
If you are pleased with a member's answer then use the Scales icon to rate it
If my reply has assistedor failed to assist you
I welcome your Feedback.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks