ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Strange Thing Happening (https://www.excelbanter.com/excel-worksheet-functions/24640-strange-thing-happening.html)

PeterK

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


All times are GMT +1. The time now is 04:52 AM.

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