View Single Post
  #1   Report Post  
PeterK PeterK is offline
Junior Member
 
Location: LI, NY
Posts: 1
Default Strange Thing Happening

I am using a macro to enter formulas into several different cells in a workbook.
The formulas are the same except for the cell references.

Range("A22").Select
ActiveCell.FormulaR1C1 = "=IF(ROUND(F22,3)=ROUND(F21,3),A21,IF(ROUND(F22,3) =ROUND(F23,3),A7&K29,L31))"

This is done 5 times during the same execution, with the first 3 resulting as expected, but the result of the last two is:
=IF(ROUND('F22',3)=ROUND('F21',3),'A21',IF(ROUND(' F22',3)=ROUND('F23',3),'A7'&'K29','L31'))

The program added the singe quote mark ' around all the cell references.

I have tried several fixes, including copying and pasting, writing them by hand, and inserting and deleting the working lines, to no avail.

I can do a "Replace" command on the page and the single quote marks are removed and the formulas then respond as expected.

Help