Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default user form and radio buttons

is there, and what would it look like, a code i can put "behind" my userform
to

1) go check colum a down sheet1 how many names
2)for each name create a radio button

3)for each radio button thats activated go and put those names in cell d24
sheet2

in other words i need it to show all the 10 or 12 names(adding to it
regularly) from column a down on sheet1 and then put the 3 or 4 names that
the user select in cell d24
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default user form and radio buttons

I used column A (A1:A###) of sheet1 to get the name.

I didn't use a radio button. Radio buttons are usually used to limit the user
to a single choice. You could use checkboxes so you could choose each name
independently.

But I used a Listbox with a style that looks like it has checkboxes next to it.

My userform had a single listbox and a commandbutton:

Option Explicit
Private Sub CommandButton1_Click()
Dim myStr As String
Dim iCtr As Long
Dim mySep As String

mySep = ", "
myStr = ""
With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next iCtr
End With

If myStr = "" Then
'nothing checked
Else
myStr = Mid(myStr, Len(mySep) + 1)
End If

Worksheets("sheet1").Range("d24").Value = myStr

End Sub
Private Sub UserForm_Initialize()
Dim myRng As Range
With Worksheets("sheet1")
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption
.List = myRng.Value
End With
End Sub


pswanie wrote:

is there, and what would it look like, a code i can put "behind" my userform
to

1) go check colum a down sheet1 how many names
2)for each name create a radio button

3)for each radio button thats activated go and put those names in cell d24
sheet2

in other words i need it to show all the 10 or 12 names(adding to it
regularly) from column a down on sheet1 and then put the 3 or 4 names that
the user select in cell d24


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User form Command Buttons jhyatt Excel Discussion (Misc queries) 3 September 25th 07 04:28 PM
How can I reset an Excel form that has radio buttons. JaxPM Excel Programming 5 May 4th 06 03:51 AM
User Form Option & Command Buttons Information Hog[_2_] Excel Programming 1 August 19th 05 10:00 PM
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True Mcasteel Excel Worksheet Functions 2 October 29th 04 07:06 PM
2 sets of option buttons on one user form? Pal Excel Programming 3 April 28th 04 02:45 PM


All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"