Explain in laymans terms what these Excel R1C1 formulas are doing so I may learn how to edit them?

54 Views Asked by At

Windows 10 Excel 2019

Can anyone explain in lay terms what the R1C1 formulas are doing, preferably in standard Excel terms (non R1C1)

I have a workbook with two worksheets and the below VBA code pulls selected data from one worksheet "Track Data2" into the second. It is pulling from 7 columns but I now need to add a further 3.

Rather than ask for the code I want to learn what the below code is doing so I can do it myself.

'   Starting with cell A2 through to cell H2, and down to row 40,000, this inserts the forumlas to
'   pull the data from the worksheet "Track Data2

'   As the formulas are in R1C1 format, and not the standard excel format, I have no idea what the
'   formulas are actually doing so I am unable to change them or add extra columns.
Range("B2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]="""","""",'Track Data'!RC)"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-2]="""","""",'Track Data'!RC)"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-3]="""","""",'Track Data'!RC[2])"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]="""","""",'Track Data'!RC[2])"
Range("F2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-5]="""","""",'Track Data'!RC[2])"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-6]="""","""",'Track Data'!RC[2])
Range("H2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-7]="""","""",'Track Data'!RC[2])"


'   I know that this auto fills the formulas down the columns
Range("A2:H2").Select
Selection.AutoFill Destination:=Range("A2:H40000"), Type:=xlFillDefault
Range("A2:H40000").Select
Application.GoTo Reference:="R2C1"

I have searched on google, and Microsoft.com but there is nothing that is able to explaing what the formulas are doing or how i may edit them or add extra columns if I wish to do so.

0

There are 0 best solutions below