View Full Version : HELP to show formula
HI out there
Can somebody tell me how I can to create a function in VBA such that it will shows the calculation of a formula.
For Example:
A1=2
B1=3
and we set cell C1=A1+B1
What I want is; to create a function, which take cell C1 and show: 2+3
Sorry my english.
Thank you
Kenneth Hobs
02-11-2013, 01:58 PM
Welcome to the forum!
Most want to show the value or the formula. To do what you want:
=A1&"+"&B1
Welcome to the forum!
Most want to show the value or the formula. To do what you want:
=A1&"+"&B1
Thank you very much.
And thank you for your quick respons. But I want more to create a function like:
Function GetFormula(Cell as Range) as String
GetFormula = Cell.Formula
End Function
Where =GetFormula(C1) will show A1+B1
So is it possible to create a function, like the one above where the outcome will be 2+2 ?
and how?
Im quite new in VBA.
Kenneth Hobs
02-11-2013, 02:23 PM
For simple mathematical operations like +, -, *, /, and such, that can be done. Much more complicated and it gets to be a nightmare.
When posting code, please paste between VBA code tags. There is no need to quote a post generally. If you must quote, just quote the relavent parts. That is why we have a threaded forum. You can always say, in your post #2 Kenneth, I noticed that you...
For a formula, you can always use Formulas > Evaluate Formulas, and Evaluate each.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.