rhino4eva

Active Member
Joined
Apr 1, 2009
Messages
260
Office Version
  1. 2010
Platform
  1. Windows
I am attempting to teach myself how to do userforms
I can draw them and get the code behind them but I am struggling to pull everything together . If I describe what I need could someone please help out

I have 7 tick boxes on a USER FROM lined up named CEA,HAV,ENT,MENIGO,PHM,PCP,RNASEp and one command button called GO

the boxes can be ticked in any combination and when go is pressed I would like a list on sheet 1 of the names ticked

I know I nearly there but just need a nudge over the hill
 
Here is another way:

Case is the same as if.

Look how this works:


Code:
Private Sub CommandButton3_Click()
'Modified 12-14-17 8:00 AM EST
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Lastrowd = Cells(Rows.Count, "D").End(xlUp).Row + 1
    For Each xcontrol In Me.Controls
        If TypeName(xcontrol) = "CheckBox" Then
            If xcontrol.Value = True Then
  
                Select Case xcontrol.Caption
                Case "HAV", "ENT", "MENIGO"
                Cells(Lastrow, 1).Value = xcontrol.Caption
                xcontrol.Value = False
                Lastrow = Lastrow + 1
                Case Else
                Cells(Lastrowd, "D").Value = xcontrol.Caption
                xcontrol.Value = False
                Lastrowd = Lastrowd + 1
                End Select
     
  
            End If
  
        End If
    Next xcontrol
End Sub
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,215,949
Messages
6,127,877
Members
449,410
Latest member
adunn_23

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