Reputation: 21
I am new in VBA and I would like to copy the formulas contained in the "Input_wkst" in the "Output_Wkst" as text.
I am trying the following code in a double for-loop, in order to consider rows and columns:
myformula = "'" & Input_Wrst.Cells(i, j).Formula
Output_Wrst.Sheets(1).Cells(i, j).Value = myformula
This code works fine, however it takes long time as it is processing cells-by-cells.
Is there a way to get the same result but using ranges of cells and therefore only one loop for rows?
For instance, is there something like
myformula = "'" & Input_Wrst.range(cells(i,1),cells(i,100)).Formula
Upvotes: 0
Views: 1049
Reputation: 17493
There is an Excel built-in function for what you want to do: =FORMULATEXT()
. You can find information on this function all over the internet (including this official URL).
Upvotes: 1