Userforms

rhino4eva

Active Member
Joined
Apr 1, 2009
Messages
262
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
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Re: More help with userforms please

Try this:
Will check all Checkboxes in your Userform
If Checkbox is checked then Checkbox Caption will be put into column "A" of the active sheet.

Code:
Private Sub Go_Click()
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
    For Each xcontrol In Me.Controls
        If TypeName(xcontrol) = "CheckBox" Then
            If xcontrol.Value = True Then
                Cells(Lastrow, 1).Value = xcontrol.Caption
                xcontrol.Value = False
                Lastrow = Lastrow + 1
            End If
        End If
    Next xcontrol
End Sub
 
Upvote 0
Re: More help with userforms please

Thanks for that it worked a treat
 
Upvote 0
Re: More help with userforms please

ok i know im being greedy
but hav ent and meningo need to be in "col a" and the others in "col d"
how do I mod for that.
 
Upvote 0
Re: More help with userforms please

You should point out all these details in your original post. This causes me more work now.

What other details have you not provided?
 
Upvote 0
Re: More help with userforms please

I'm going to let you learn some Vba scripting. And let you make the changes you want.
 
Upvote 0
Re: More help with userforms please

ok no worries ..... will give it a go
 
Upvote 0
Re: More help with userforms please

I think if you try a few if statements. Like if control.caption="ent" or control.caption="meningo"

You can get this to work.

It's always best to try things yourself and you will learn Vba. Getting a answer from me without trying yourself will not help you as much. If you cannot figure it out let me know.
 
Upvote 0
Re: More help with userforms please

I have had a go with if thens but its not as elegant as you solution. Never done userform so we're completely unaware of control.caption so have learnt today thanks to your good self
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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