ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   ActiveCell.FormulaR1C1 (https://www.excelbanter.com/excel-discussion-misc-queries/260097-activecell-formular1c1.html)

Rick

ActiveCell.FormulaR1C1
 
I need help....
The following statement is being used in a do loop.

ActiveCell.FormulaR1C1 = "=IF(" & TagNmeMe & "!R[" & Cnt1 &
"]C[-1]="""",""""," & TagNmeMe & "!R[" & Cnt1 & "]C[-1])"

What I need it to do is this:
if(sheet1!A5="","",sheet1!a5) then 9 rows down paste this:
if(sheet2!A5="","",sheet2!a5)

Problem is when recording a macro the cnt1 changes from nothing to 9 then to
18 but the formula does not mimic what recording did.

FSt1

ActiveCell.FormulaR1C1
 
hi
try....
ActiveCell.Formula = "=IF(Sheet1!A5="""","""",Sheet1!A5)"
Activecell.offset(9,0).formula = "=IF(Sheet2!A5="""","""",Sheet2!A5)"

regards
FSt1

"Rick" wrote:

I need help....
The following statement is being used in a do loop.

ActiveCell.FormulaR1C1 = "=IF(" & TagNmeMe & "!R[" & Cnt1 &
"]C[-1]="""",""""," & TagNmeMe & "!R[" & Cnt1 & "]C[-1])"

What I need it to do is this:
if(sheet1!A5="","",sheet1!a5) then 9 rows down paste this:
if(sheet2!A5="","",sheet2!a5)

Problem is when recording a macro the cnt1 changes from nothing to 9 then to
18 but the formula does not mimic what recording did.


Rick

ActiveCell.FormulaR1C1
 
Thanks for the tip...
Modified your suggestion to this and it works perfectly.

ActiveCell.Offset(Cnt1, 0).Formula = "=IF(" & TagNmeMe & "!A5="""",""""," &
TagNmeMe & "!A5)"

"FSt1" wrote:

hi
try....
ActiveCell.Formula = "=IF(Sheet1!A5="""","""",Sheet1!A5)"
Activecell.offset(9,0).formula = "=IF(Sheet2!A5="""","""",Sheet2!A5)"

regards
FSt1

"Rick" wrote:

I need help....
The following statement is being used in a do loop.

ActiveCell.FormulaR1C1 = "=IF(" & TagNmeMe & "!R[" & Cnt1 &
"]C[-1]="""",""""," & TagNmeMe & "!R[" & Cnt1 & "]C[-1])"

What I need it to do is this:
if(sheet1!A5="","",sheet1!a5) then 9 rows down paste this:
if(sheet2!A5="","",sheet2!a5)

Problem is when recording a macro the cnt1 changes from nothing to 9 then to
18 but the formula does not mimic what recording did.


FSt1

ActiveCell.FormulaR1C1
 
great
thanks for the feed back.

regards
FSt1

"Rick" wrote:

Thanks for the tip...
Modified your suggestion to this and it works perfectly.

ActiveCell.Offset(Cnt1, 0).Formula = "=IF(" & TagNmeMe & "!A5="""",""""," &
TagNmeMe & "!A5)"

"FSt1" wrote:

hi
try....
ActiveCell.Formula = "=IF(Sheet1!A5="""","""",Sheet1!A5)"
Activecell.offset(9,0).formula = "=IF(Sheet2!A5="""","""",Sheet2!A5)"

regards
FSt1

"Rick" wrote:

I need help....
The following statement is being used in a do loop.

ActiveCell.FormulaR1C1 = "=IF(" & TagNmeMe & "!R[" & Cnt1 &
"]C[-1]="""",""""," & TagNmeMe & "!R[" & Cnt1 & "]C[-1])"

What I need it to do is this:
if(sheet1!A5="","",sheet1!a5) then 9 rows down paste this:
if(sheet2!A5="","",sheet2!a5)

Problem is when recording a macro the cnt1 changes from nothing to 9 then to
18 but the formula does not mimic what recording did.



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

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