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
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Code:
If OptionButton1 Then
    Range("B2") = Range("A2") * 10
ElseIf OptionButton2 Then
    Range("B2") = Range("A2") * 20
Else
    Range("B2") = Range("A2")
End If
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,961
Latest member
nzskater

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