ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula Replacement (https://www.excelbanter.com/excel-programming/322586-formula-replacement.html)

Lee

Formula Replacement
 
I have a worksheet that I need to replace the formula in
numerous cells. Below is a portion of the SUB I set up to
replace the formula in one of the cells

Sub Discrete_Update()
.......
Range("E3").Select
ActiveCell.FormulaR1C1 = _
"=IF('BOE-Data & Text'!
L14<""Discrete"","""",Task_Start_Date)"
.......
End Sub

It replaces the formula but places tic marks around the
cell address (L14). =IF('BOE-Data &
Text'!'L14'<"Discrete","",Task_Start_Date)

This causes the cell to display #Name?. As soon as I go
to the cell and remove the tic marks the formula works
fine.

Any ideas why this is happening and what I can do to
correct it?

Thanks,

Lee



Tom Ogilvy

Formula Replacement
 
Range("E3").Formula = _
"=IF('BOE-Data & Text'!L14<""Discrete"","""",Task_Start_Date)"

Since your reference is in A1, not R1C1 use Just formula rather than
formulaR1C1

--
Regards,
Tom Ogilvy


"Lee" wrote in message
...
I have a worksheet that I need to replace the formula in
numerous cells. Below is a portion of the SUB I set up to
replace the formula in one of the cells

Sub Discrete_Update()
.......
Range("E3").Select
ActiveCell.FormulaR1C1 = _
"=IF('BOE-Data & Text'!
L14<""Discrete"","""",Task_Start_Date)"
.......
End Sub

It replaces the formula but places tic marks around the
cell address (L14). =IF('BOE-Data &
Text'!'L14'<"Discrete","",Task_Start_Date)

This causes the cell to display #Name?. As soon as I go
to the cell and remove the tic marks the formula works
fine.

Any ideas why this is happening and what I can do to
correct it?

Thanks,

Lee





Paul

Formula Replacement
 
how about

[a1:a20].Copy [c1]

which will copy the contents of a1:a20 (containing the new
formulas) to c1 to c20 (containing the formulas to be
replaced)

-----Original Message-----
I have a worksheet that I need to replace the formula in
numerous cells. Below is a portion of the SUB I set up

to
replace the formula in one of the cells

Sub Discrete_Update()
.......
Range("E3").Select
ActiveCell.FormulaR1C1 = _
"=IF('BOE-Data & Text'!
L14<""Discrete"","""",Task_Start_Date)"
.......
End Sub

It replaces the formula but places tic marks around the
cell address (L14). =IF('BOE-Data &
Text'!'L14'<"Discrete","",Task_Start_Date)

This causes the cell to display #Name?. As soon as I go
to the cell and remove the tic marks the formula works
fine.

Any ideas why this is happening and what I can do to
correct it?

Thanks,

Lee


.



All times are GMT +1. The time now is 10:51 AM.

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