ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   evaluate a year expression (https://www.excelbanter.com/excel-programming/400814-evaluate-year-expression.html)

Clint Eastwood[_2_]

evaluate a year expression
 
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

John Bundy

evaluate a year expression
 
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" wrote:

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


Clint Eastwood[_2_]

evaluate a year expression
 
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" wrote:

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" wrote:

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



All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com