Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default print each row in the list in the combo bos

What I really want to know is how to parse the range value in the
case of the "All" selection in the user form? The user form loads
so I will forget about the rowsource. I need to loop through the range
and print each row in the cpyAllPatientsShts() . So it would be a for
each or something see below? I'm not sure how to get the range from
the form into the subscript in the module and print each line.
TNX,
Sub UserForm_Initialize()

Dim lngLastRow As Long
Dim ws As Worksheet
Dim c As Range
Dim rng As Range

Set ws = ThisWorkbook.Worksheets("patients")
lngLastRow = Cells(Rows.Count, "b").End(xlUp).Row


Set rng = ws.Range("C1:C" & lngLastRow)

For Each c In rng.Cells
Me.ComboBox2.AddItem c.Value
Next c

Me.ComboBox2.AddItem "All"
Me.ComboBox2.AddItem "Exit"

End Sub
-----------------------------------

Public Sub cpyAllPatientsShts()
Dim c As Range
Dim i
For Each c In UserForm1.rng
UserForm1.rng
wb.Sheets(2).Copy befo=wb.Sheets(2)
Set ws = wb.Sheets(2)
sStr = UserForm1.g_fNameLName
Lname = Mid(sStr, InStr(1, sStr, " ") + 1)
Next i
End Sub

tHANKS,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default print each row in the list in the combo bos

You appear to already have a loop that loads the UserForm control ComboBox2
with the range of values required that is stored in rng

Use the same method to read each cell in the range and pass the values to
the print routine, it it not clear to me what your cpyAllPatientsShts()
routine is doing or trying to do?

--

Regards,
Nigel




"Janis R" wrote in message
...
What I really want to know is how to parse the range value in the
case of the "All" selection in the user form? The user form loads
so I will forget about the rowsource. I need to loop through the range
and print each row in the cpyAllPatientsShts() . So it would be a for
each or something see below? I'm not sure how to get the range from
the form into the subscript in the module and print each line.
TNX,
Sub UserForm_Initialize()

Dim lngLastRow As Long
Dim ws As Worksheet
Dim c As Range
Dim rng As Range

Set ws = ThisWorkbook.Worksheets("patients")
lngLastRow = Cells(Rows.Count, "b").End(xlUp).Row


Set rng = ws.Range("C1:C" & lngLastRow)

For Each c In rng.Cells
Me.ComboBox2.AddItem c.Value
Next c

Me.ComboBox2.AddItem "All"
Me.ComboBox2.AddItem "Exit"

End Sub
-----------------------------------

Public Sub cpyAllPatientsShts()
Dim c As Range
Dim i
For Each c In UserForm1.rng
UserForm1.rng
wb.Sheets(2).Copy befo=wb.Sheets(2)
Set ws = wb.Sheets(2)
sStr = UserForm1.g_fNameLName
Lname = Mid(sStr, InStr(1, sStr, " ") + 1)
Next i
End Sub

tHANKS,


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
Combo Box Print issue Jack_Feeman Excel Programming 2 October 20th 06 03:59 PM
combo/text box print issue Kim K Excel Discussion (Misc queries) 7 September 29th 06 08:21 PM
Print Marco with a Combo Box LT Excel Programming 3 June 17th 06 07:22 PM
Filtered list for Combo Box ListFillRange - Nested Combo Boxes DoctorG Excel Programming 3 February 23rd 06 12:15 PM
Print the results of the combo box Hank Hendrix Excel Programming 1 April 18th 04 02:02 AM


All times are GMT +1. The time now is 09:19 AM.

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"