Forum Discussion
Carlos Spörk
Apr 26, 2019Brass Contributor
Issue in VBA Function to copy the formula result in one cell and paste as a value into another cell
The Function below copies a formula result from one cell and pastes it as a value into a different cell in the same worksheet. I expected to store this Function in an .xlam file in order to avoid sav...
- Apr 29, 2019Functions called from a formula in a cell cannot make changes to any other cells, they return their result to the cell that uses the function in its formula.
JKPieterse
Apr 29, 2019Silver Contributor
Functions called from a formula in a cell cannot make changes to any other cells, they return their result to the cell that uses the function in its formula.
- Carlos SpörkApr 29, 2019Brass Contributor
@Jan Karel Pieterse Thank you. It looks like I will need to save my template as a macro-enabled file. Or, continue to manually copy the formula cell and paste it as a value.
- JKPieterseApr 30, 2019Silver ContributorIt does not matter where this code is located, as long as it is called from a worksheet function it cannot affect other cells than the one it was called from. Period. But you can write a sub which does what you need and call that in an add-in or in your personal macro workbook.
- Carlos SpörkApr 30, 2019Brass ContributorI realize now that my initial reply was not clear enough. My apologies. I had already understood that an Excel function invoked from a cell in a worksheet can not modify other cells.
On the other hand, I already tried the workaround you suggested, and it obviously works. Thank you so much!
Cheers.