userform option button to worksheet text value

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,199
Office Version
  1. 2007
Platform
  1. Windows
Morning,
Below is part of my code is in use which works fine apart from the Option Button code.
On my userform i have 4 Option buttons.
OptionButton1 = 41601
OptionButton2 = UPRATED 41601
OptionButton3 = 41835
OptionButton4 = UPRATED 41835

The user will only select one of these options but im not sure who to get the value into the worksheet cell correctly.
The current line of code below transfers to the correct cell but shows value as opposed to what the option button value is,make sense to you ?


Rich (BB code):
With ThisWorkbook.Worksheets("RANGER")
    .Range("B5").Value = TextBox1.Text
    .Range("D5").Value = TextBox2.Text
    .Range("F5").Value = TextBox3.Text
    .Range("C5").Value = ComboBox1.Text
    .Range("G5").Value = ComboBox2.Text
    .Range("H5").Value = ComboBox3.Text
    .Range("E5").Value = OptionButton1.Value
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
set Caption
OptionButton1 = 41601
OptionButton2 = UPRATED 41601
OptionButton3 = 41835
OptionButton4 = UPRATED 41835

Then some thing like
VBA Code:
 For i = 1 To 4
        If Me.Controls("OptionButton" & i) = True Then
            .Range("E5").Value = Me.Controls("OptionButton" & i).Caption
        End If
    Next
 
Upvote 0
Solution
You are very welcome
And thank you for the feedback
Be happy
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,267
Members
448,558
Latest member
aivin

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