ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveCell.FormulaR1C1 (https://www.excelbanter.com/excel-programming/433357-activecell-formular1c1.html)

Slohcin

ActiveCell.FormulaR1C1
 
I have the following lines in my code:

ActiveCell.FormulaR1C1 = "=IF(RC[6]=""AA"",""ST"",""EA"")"
Range("D2").Select

This sets the value of one cell to ST if another equals AA, if not it sets
the value to EA. I have now found that AA may be AA or AB or AX but I still
need the second cell to be set to ST or EA, how do I do this?
--
Thanks
Slohcin

Sam Wilson

ActiveCell.FormulaR1C1
 
ActiveCell.FormulaR1C1 =
"=IF(OR(RC[6]=""AA"",RC[6]=""AB"",RC[6]=""AX""),""ST"",""EA"")"


"Slohcin" wrote:

I have the following lines in my code:

ActiveCell.FormulaR1C1 = "=IF(RC[6]=""AA"",""ST"",""EA"")"
Range("D2").Select

This sets the value of one cell to ST if another equals AA, if not it sets
the value to EA. I have now found that AA may be AA or AB or AX but I still
need the second cell to be set to ST or EA, how do I do this?
--
Thanks
Slohcin


Slohcin

ActiveCell.FormulaR1C1
 
Many thanks Sam for your quick response and solution.
--
Thanks
Slohcin


"Sam Wilson" wrote:

ActiveCell.FormulaR1C1 =
"=IF(OR(RC[6]=""AA"",RC[6]=""AB"",RC[6]=""AX""),""ST"",""EA"")"


"Slohcin" wrote:

I have the following lines in my code:

ActiveCell.FormulaR1C1 = "=IF(RC[6]=""AA"",""ST"",""EA"")"
Range("D2").Select

This sets the value of one cell to ST if another equals AA, if not it sets
the value to EA. I have now found that AA may be AA or AB or AX but I still
need the second cell to be set to ST or EA, how do I do this?
--
Thanks
Slohcin


Dave Peterson

ActiveCell.FormulaR1C1
 
Another one that is a little easier to update if/when things change:

ActiveCell.FormulaR1C1 _
= "=IF(OR(RC[6]={""AA"",""AB"",""AX""}),""ST"",""EA"")"




Slohcin wrote:

I have the following lines in my code:

ActiveCell.FormulaR1C1 = "=IF(RC[6]=""AA"",""ST"",""EA"")"
Range("D2").Select

This sets the value of one cell to ST if another equals AA, if not it sets
the value to EA. I have now found that AA may be AA or AB or AX but I still
need the second cell to be set to ST or EA, how do I do this?
--
Thanks
Slohcin


--

Dave Peterson


All times are GMT +1. The time now is 03:46 AM.

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