Is it possible to put and formula in a command button?

Romano_odK

Active Member
Joined
Jun 4, 2020
Messages
379
Office Version
  1. 365
Platform
  1. Windows
Good evening,

I would like to add a fomula like a SUM or more complex into a command button? Is that possible?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hmm...
If I am understanding you what I would do is
1) write the desired formula
2) With the cell containing the formula selected, Start Macro recorder
3) press F2 (to edit) and press enter
4) Stop recorder
5) Create command button and assign macro

Because the formula was in the selected cell, this macro should write the formula you just created in the current active cell
Start with that. If the formula is in R1C1 format you should be okay as long as the formula is always written the same way

Seems like there may be potential for errors but based on muy interpretation of your request, this may solve it.
Let me know

ps. a better way may be to use the Name Manager to write your formula in the way you do LAMBDAs..
 
Upvote 0
Solution
Hmm...
If I am understanding you what I would do is
1) write the desired formula
2) With the cell containing the formula selected, Start Macro recorder
3) press F2 (to edit) and press enter
4) Stop recorder
5) Create command button and assign macro

Because the formula was in the selected cell, this macro should write the formula you just created in the current active cell
Start with that. If the formula is in R1C1 format you should be okay as long as the formula is always written the same way

Seems like there may be potential for errors but based on muy interpretation of your request, this may solve it.
Let me know

ps. a better way may be to use the Name Manager to write your formula in the way you do LAMBDAs..
Thank you for your advice, I am going to do this differently I think.
 
Upvote 0

Forum statistics

Threads
1,215,767
Messages
6,126,773
Members
449,336
Latest member
p17tootie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top