Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

how to add

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Excel-Programming - 18 Jan 2008 00:16 GMT
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,
Dave Peterson - 18 Jan 2008 01:50 GMT
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.

> 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?
[quoted text clipped - 29 lines]
>
> thanks again,

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.