View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
external usenet poster
 
Posts: 863
Default Year Date Format

You have used the FormulaR1C1 property, which expects the range in R1C1
notation, BUT you used A1 notation in the formula. You should use

ActiveCell.Formula = "=TEXT(B4,"yyyy")"

not FormulaR1C1.


On Mon, 5 Nov 2007 05:17:03 -0800, mathel
wrote:

Sorry, I hit Post on the previous question accidently.....

To repeat, I am trying to extract the year only in a cell based on the date
in another cell. What I have in vba is:

Range("J4").Select
ActiveCell.FormulaR1C1 = "=text(b4, "yyyy")"

This returns an error: Compile Error: Expected: end of statement

What am I doing wrong.

Thanks