The workbook contains 3 worksheets. They are labeled Data 1, 2 and 3. Data 1 worksheet has that formula generated by VBA. So based on the below example, the question I have is there any other way to reference the 2 worksheets Data 2 and Data 3. I want to reference those 2 worksheets dynamically. If I add a worksheet or delete a worksheet, I would like the program to adjust for this. I hope this is clear enough. If not let me know.
VBA Code:
Sub Formula1()
Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM('Data 2:Data 3'!RC)"
Range("A2").Select
End Sub
Formula Worksheet.xlsm | |||
---|---|---|---|
A | |||
1 | 12 | ||
Data 1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A1 | A1 | =SUM('Data 2:Data 3'!A1) |