Is there a way to use VBA to insert the formula in R1C1 or Regular Reference format by using ranges? I need the formula to be present in Range2, not just the quotient.
The formula (once inserted) will be autofilled to 10 rows down once it is done. As of now, this formula will only put the Numerical ANSWER (of the quotient)
Code:
Sub I_Am_Cool()
Dim Range0 As Range, Range1 As Range, Range2 As Range, scol As Integer, srow As Integer
srow = 1
scol = 1
Do While (Not IsEmpty(Cells(srow, scol)))
scol = scol + 1
Loop
Set Range1 = Cells(srow, scol).Offset(2, -1)
Set Range0 = Range1.Offset(0, 4)
Set Range2 = Range1.Offset(3, 3)
Range2.Formula = Range1 / Range0
End Sub
When I do this formula, it just gives me the answer in numerical format. Also, if it was division by 0 (it will happen in the report), it gives a debug error.
I have been searching forums and books for a week and cannot seem to find an answer.
Any help would be greatly appreciated!
Thanks!
Just a note:
I simplified the problem to make the answer easier. Range1 and Range2 will not always be the same cell (it's a rolling average spreadsheet).
Bookmarks