how to add

E

Excel-Programming

I have a question on this userform. It now loads nicely. Thanks.
Is there a way to add a choice called all to the end of the list?
That way the user can select which name to print or select all. In
the case of all
I need to print all the sheets.
That way it is a simple if/then. if one is selected print that one if
all is selected I will have to capture that.
tnx,



Private Sub UserForm_Initialize()

'Dim intLastRow As Integer
Dim ws As Worksheet
Dim c As Range
'Dim rng As Range
Set ws = ThisWorkbook.Worksheets("patients")


intLastRow = Cells.Find(What:="*", After:=ws.Range("A1"),
SearchDirection:=xlPrevious).Row

Set rng = Worksheets("patients").Range("A1:A" & intLastRow)
Me.ComboBox2.Clear
For Each c In g_rng
Me.ComboBox2.AddItem c.Value
Next c

End Sub

I took a leap of faith and added Me.ComboBox2.Additem "All" right
under the Me.ComboBox2.Additem c.Value line. What I got was a list
interpersed with "all" instead of only once.

thanks again,
 
D

Dave Peterson

Add it after you've added the other stuff.

For Each c In g_rng
Me.ComboBox2.AddItem c.Value
Next c
me.combobox2.additem "All"

Just curious. Did you read the reply I gave at your initial post.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top