Need help creating Userform with data from Cells

nzepeda

Board Regular
Joined
Nov 11, 2010
Messages
58
I am trying to make a Userform that will display Sheet1 cells A1 and B1 down to A16 and B16 side by side with check boxes. The user must select 1 and only 1 option and this will be input into sheet 2 at A1 and B1 respectively. There will not be any blanks between the cells when going down, but not all the cells will used all the time, 16 is just the maximum.

I think I know how to make the look, but what I am having trouble with is getting the checkboxes to appear on the form along with the code for the userform to know where to look to get the values and what to do with it.

Any help would be appreciated.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
The user must select 1 and only 1 option

Then you should NOT be using checkboxes, you should be using radio[option] buttons. Checkboxes are designed to be used when MORE than one option is to be selected.
 
Upvote 0
Ok, that makes sense. Unfortunately that still does not completely solve my problem.

How would I go about making it so my Userform will check to see if there is a value in Sheet1 A1, then displaying that with a radio button. Then once the user hits "Ok" that value is placed in Sheet2 A1.
 
Upvote 0
I can't write all that code for you right now, but here's something to get you started. Paste this in as code for your user form. When the form gets called, it will show the option buttons with the values from columns A & B as their captions.

I'll let you work out the rest.

Code:
Private Sub UserForm_Initialize()
Dim i As Integer
Dim ob As Object
    
    i = 1
    For Each ob In Me.Controls
        If Mid(ob.Name, 1, 12) = "OptionButton" Then
            ob.Caption = Sheet1.Range("A" & i).Value & " - " & Sheet1.Range("B" & i).Value
            i = i + 1
        End If
    Next ob
    
End Sub
 
Upvote 0
I think from here I can do the rest.

Thank you.

I will try this and let you know how I do.

Thank you again.
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,304
Members
452,904
Latest member
CodeMasterX

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