J
Janis R
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 before:=wb.Sheets(2)
Set ws = wb.Sheets(2)
sStr = UserForm1.g_fNameLName
Lname = Mid(sStr, InStr(1, sStr, " ") + 1)
Next i
End Sub
tHANKS,
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 before:=wb.Sheets(2)
Set ws = wb.Sheets(2)
sStr = UserForm1.g_fNameLName
Lname = Mid(sStr, InStr(1, sStr, " ") + 1)
Next i
End Sub
tHANKS,