How to copy formulas in VBA code.
Learned that the hard way, just like most of my computer knowledge
In another word, the difference between .Formula and .FormulaR1C1
When filling formulas in VBA of Excel, we use .Formula (or .FormulaR1C1)
> If you fill in formula in row 8 from a formula in row 6, then you HAVE to do the following
1- Formula in row 6 should reference row 8
2- Use .Formula to copy the formula, do not use .FormulaR1C1
> Formula in AD6 is
=SUM(AE8,AC8)/2
> Fill in use below command
ThisWorkbook.Worksheets(ShtData).Range("AW8:BM" & K).Formula = _
ThisWorkbook.Worksheets(ShtData).Range("AW6:BM6").Formula
> Fill down from the above settings
Range("C46:I46").FillDown
> If you fill in formula in row 8 from a formula in row 6, then you HAVE to do the following
1- Formula in row 6 should reference row 8
2- Use .Formula to copy the formula, do not use .FormulaR1C1
> Formula in AD6 is
=SUM(AE8,AC8)/2
> Fill in use below command
ThisWorkbook.Worksheets(ShtData).Range("AW8:BM" & K).Formula = _
ThisWorkbook.Worksheets(ShtData).Range("AW6:BM6").Formula
> Fill down from the above settings
Range("C46:I46").FillDown
Views 1,645
Downloads 553
CodeID
DB ID