Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
287 views
in Technique[技术] by (71.8m points)

vba macro excel - formula question after running a macro

i have a simple question but i can't find an answer in google.

i have the following simple code:

cells(1,1)= cells(1,2) + cells(1,3)

i want to be able to show the user the result in cells(1,1) but that he can also see how i got it (if he stands on the cell he should see that i did =B1+C1). how can i do it?

moreover, i want him to be able to change the numbers in B1,C1 and get a new result in A1 like regular he could do in regular excel function how can i do it?

thanks!

question from:https://stackoverflow.com/questions/65848768/vba-macro-excel-formula-question-after-running-a-macro

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think you may want to just add a formula to the cell and not put in a value.

Check this out. VBA To Add Formula To Cell

Not exactly what you are asking but it shows you how to add a formula in your vba code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...