If macro help needed.

slm7678

Board Regular
Joined
Sep 26, 2002
Messages
60
hello all,

long time no post. i am trying to write some code for a command button.
what i have are two option buttons and one command button.
what i would like for it to do would be this:

if option button 1 is true then take A2*10 when command button is pressed

if option button 2 is true then take A2*20 when command button is pressed.
(these are simplified examples but i think i can work the rest in if i get a good starting place.)

im not sure how to proceed. im pretty sure i want an if then statement but i leave it in your capable hands.

TIA
Shannon
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

TommyGun

MrExcel MVP
Joined
Dec 9, 2002
Messages
4,202
Code:
If OptionButton1 Then
    Range("B2") = Range("A2") * 10
ElseIf OptionButton2 Then
    Range("B2") = Range("A2") * 20
Else
    Range("B2") = Range("A2")
End If
 

Watch MrExcel Video

Forum statistics

Threads
1,122,498
Messages
5,596,509
Members
414,073
Latest member
Contilly

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
Top