S
S Clause
Hello,
I receive a report every month upon which I run a macro that I've recorded
(below) in order to calculate whether a person is to receive a birthday card or
not. The macro uses the NOW function to calculate the person's age and if they
are 80+, they will get a card i.e if the person's birthday was Dec. 24, 1927,
then based on the formula "=(TEXT(NOW(),"yyyy")-1927)" the result would be 76.
It works perfectly except when I need to find out who is to get a card in
January, as I receive January's report in December. The formula that I am using
is based on the current year, and what I need is a formula that will calculate
the age using the current year +1, or if there is a better solution, please let
me know. I probably haven't explained this very well, but I'm hoping someone
might be able to make sense of what I am trying to do and point me in the right
direction.
Cheers,
Angela
' BCR_cleanup Macro
' Macro recorded 12/16/2003 by Angela Farmer
'
'
Sheets("Welcome").Select
ActiveWindow.SelectedSheets.Delete
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Range("C2").Select
ActiveCell.FormulaR1C1 = "=(TEXT(NOW(),""yyy"")-RC[1])"
Range("C2").Select
Selection.Copy
Columns("C:C").Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("C1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "AGE"
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="Alumnus/Alumna (Grad)"
Selection.AutoFilter Field:=3, Criteria1:=">=80", Operator:=xlAnd
Selection.Copy
Sheets.Add
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub
I receive a report every month upon which I run a macro that I've recorded
(below) in order to calculate whether a person is to receive a birthday card or
not. The macro uses the NOW function to calculate the person's age and if they
are 80+, they will get a card i.e if the person's birthday was Dec. 24, 1927,
then based on the formula "=(TEXT(NOW(),"yyyy")-1927)" the result would be 76.
It works perfectly except when I need to find out who is to get a card in
January, as I receive January's report in December. The formula that I am using
is based on the current year, and what I need is a formula that will calculate
the age using the current year +1, or if there is a better solution, please let
me know. I probably haven't explained this very well, but I'm hoping someone
might be able to make sense of what I am trying to do and point me in the right
direction.
Cheers,
Angela
' BCR_cleanup Macro
' Macro recorded 12/16/2003 by Angela Farmer
'
'
Sheets("Welcome").Select
ActiveWindow.SelectedSheets.Delete
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Range("C2").Select
ActiveCell.FormulaR1C1 = "=(TEXT(NOW(),""yyy"")-RC[1])"
Range("C2").Select
Selection.Copy
Columns("C:C").Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("C1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "AGE"
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="Alumnus/Alumna (Grad)"
Selection.AutoFilter Field:=3, Criteria1:=">=80", Operator:=xlAnd
Selection.Copy
Sheets.Add
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub