OptionButton value to change from True/False to Yes/No

danbates

Active Member
Joined
Oct 8, 2017
Messages
377
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Please can someone help me?

I would like to change the optionbutton value from true to Yes and False to No. Is this possible?

This is the code I have at the moment:
Code:
Sheets("Data").Cells(lrcd + 1, "D").Value = OptionButton1.Value

Sheets("Data").Cells(lrcd + 1, "D").Value = OptionButton2.Value

OptionButton1 is labelled as Yes and OptionButton2 as No.

Regards

Dan
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
An option button has two Boolean values of either True or False. So if you write the code to use the OptionButton.Value you will get the Value based on current status of the button. Selected = True, unselected = False. To get a value of "Yes" or "No" to display in a cell, you would need to write the code something like this.
Code:
If OptionButton1.Value = True Then
 Sheets("Data").Cells(lred + 1, "D") = "Yes"
ElseIf OptionButton2.Value = False Then
 Sheets("Data").Cells(lred + 1, "D") = "No"
End If
 
Upvote 0
Hi JLGWhiz,

You code has worked just as I wanted, Thank you.

Kind Regards

Dan
 
Upvote 0

Forum statistics

Threads
1,214,954
Messages
6,122,462
Members
449,085
Latest member
ExcelError

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