FYI : this is my 1st post! thanks for your understanding as I am not familar w the process :-)
I recorded a macro in my excel file to enter a formula over a range. the formula works perfectly but when I run the macro itself, with the same formula, excel add a "@" beofre the offset function and then got a 0 as result instead of the correct value I had doing it manually!
When I try to remove the "@" (by replacing them by "") : no change, no replacement! I tried bioth manually and via the vba code as shown below...
Here is my code so far : thank in advance for your help:
'Add totals in the main tool
Application.Goto Reference:="ELTUSIZE"
'Sum up the #N/A of the columns in a row right below range ELTUSIZE
Range("ELTUSIZE").Resize(1, Range("ELTUSIZE").Columns.Count).Offset(Range("ELTUSIZE").Rows.Count, 0). _
FormulaR1C1 = "=SUM(IF(ISNA(OFFSET(Product_code,0,COLUMN(RC)-1,,)),1,0))"
'Need to remove the @ automatically added by excel due to the language upgrade wrt array_formula!
Selection.Replace What:="(@OFFSET", Replacement:="(OFFSET", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Cells(1, 1).Offset(Range("ELTUSIZE").Rows.Count, 0). _
FormulaR1C1 = "=SUM(OFFSET(ELTUSIZE,ROWS(ELTUSIZE),1,1,columns(ELTUSIZE)-1))" 'column-1 because the 1st column is used for the total!