Thread
:
print each row in the list in the combo bos
View Single Post
#
2
Posted to microsoft.public.excel.programming
Nigel[_2_]
external usenet poster
Posts: 735
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 With Quote
Nigel[_2_]
View Public Profile
Find all posts by Nigel[_2_]