View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim May Jim May is offline
external usenet poster
 
Posts: 430
Default how to achieve this

Mike:
The OP's Combobox1...(question).
How did/would you populate a combobox with
The sheet names (and of course make it dynamic)?
Thanks,
Jim

"Mike Fogleman" wrote in message
:

Sub CommandButton1_Click() 'Populate
Dim ws As Worksheet
With UserForm1
Set ws = Worksheets(.ComboBox1.Value)
If .OptionButton1.Value = True Then 'males
.TextBox1.Value = ws.Range("B2")
.TextBox2.Value = ws.Range("B3")
.TextBox3.Value = ws.Range("B4")
Else 'females
.TextBox1.Value = ws.Range("C2")
.TextBox2.Value = ws.Range("C3")
.TextBox3.Value = ws.Range("C4")
End If
End With
End Sub

This is untested so give it a shot.
Mike F
"tkraju via OfficeKB.com" <u16627@uwe wrote in message
news:64341184d6db6@uwe...

In my user form,I have a combo box which has w/sheet names and two option
buttons 1.males,2.females. In each sheet of my w/book ,range b2:b4 = names
of
males and range c2:c4 =names of females.I have 3 text boxes and cmd
button
'populate'.If I select w/sheet name from combobox and select an option say
2.
females,and press populate button ,the relevant sheet's females names be
populated in 3 text boxes. I have created a user form but unable add
code.
How to achieve this?.Any help is sincerely appreciated.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200608/1