evaluate a year expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the proper expression to eval the following formula?? I keep getting
#name? in my spreadsheet.

Thanks

For i = 2007 To 2009


Selection.AutoFilter
Range("F3").Select
ActiveCell.FormulaR1C1 = "=YEAR(RC[-5])=i"

..
..
..
..
next i
 
You are probably looking for the formula to be
ActiveCell.FormulaR1C1 = "=YEAR(RC[-5])=" & i

but it really depends on what you are trying to do, your variable i was just
plugged in as a letter since it was in "".
 
John,
That solved the problem. Thanks. If you need more info to give to someone
else ( the rest of the code?0 let me know. Again, thanks !!
Clint E.
John Bundy said:
You are probably looking for the formula to be
ActiveCell.FormulaR1C1 = "=YEAR(RC[-5])=" & i

but it really depends on what you are trying to do, your variable i was just
plugged in as a letter since it was in "".
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


Clint Eastwood said:
What is the proper expression to eval the following formula?? I keep getting
#name? in my spreadsheet.

Thanks

For i = 2007 To 2009


Selection.AutoFilter
Range("F3").Select
ActiveCell.FormulaR1C1 = "=YEAR(RC[-5])=i"

.
.
.
.
next i
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top