
Originally Posted by
mariec_06
In this userform I would have like to be able to select several ref and to populate the userform with infos for each of them..
The PANDL form can only display the info for one REF at a time. Why have a multi-select list?
I don't know how to say for each selected item in the listbox "REF", get datas.....
but obviously the ref.value remain "null".....
can someone give me some tips to search further?
Use the index number i to get the selected RefNumber from the list and pass it to the GetData procedure.
For i = 0 To Me.REF.ListCount - 1
If Me.REF.Selected(i) Then
GetData Me.REF.List(i)
End If
Next i
Then use the passed RefNumber to search
Sub GetData(RefNumber As String)
Dim irow As Long
Dim irow1 As Long
Dim irow2 As Long
Dim IROW3 As Long
Dim IROW4 As Long
Dim WSH As Worksheet
Dim WSH1 As Worksheet
Dim wsh2 As Worksheet
Dim WSH3 As Worksheet
Dim wsh4 As Worksheet
Set WSH = ThisWorkbook.Worksheets("RECAP")
Set WSH1 = ThisWorkbook.Worksheets("PRICING FINAL")
Set wsh2 = ThisWorkbook.Worksheets("PANDL")
Set WSH3 = ThisWorkbook.Worksheets("DEM CALC")
Set wsh4 = ThisWorkbook.Worksheets("pricing provisional")
irow = WSH.Cells.Find(What:=RefNumber, LookIn:=xlValues, SearchOrder:=xlRows, SearchDirection:=xlPrevious).row
irow1 = WSH1.Cells.Find(What:=RefNumber, LookIn:=xlValues, SearchOrder:=xlRows, SearchDirection:=xlPrevious).row
irow2 = wsh2.Cells.Find(What:=RefNumber, LookIn:=xlValues, SearchOrder:=xlRows, SearchDirection:=xlPrevious).row
IROW3 = WSH3.Cells.Find(What:=RefNumber, LookIn:=xlValues, SearchOrder:=xlRows, SearchDirection:=xlPrevious).row
IROW4 = wsh4.Cells.Find(What:=RefNumber, LookIn:=xlValues, SearchOrder:=xlRows, SearchDirection:=xlPrevious).row
There are many other problems with the GetData code, but this is how to pass each selected RefNumber in the Ref.List to GetData.
Bookmarks