
Function Lotti(a)
Dim rng As Range
Dim cel As Range
Dim val As String
Dim stringa As String
stringa = "Fornitore" & " " & UCase(a) & " " & "Lotti"
Set rng = Worksheets("LOTTI").Range("f1:f130")
For Each cel In rng
If cel.Value = a Then
val = val & ", " & cel.Offset(0, 1).Value
End If
Next cel
Lotti = stringa & val
End Function
|
Function Lotti(a)
Dim rng As Range
Dim cel As Range
Dim val As String
Dim stringa As String
Dim ur As Long
ur = Worksheets("LOTTI").Cells(Rows.Count, "F").End(xlUp).Row
stringa = "Fornitore" & " " & UCase(a) & " " & "Lotti"
Set rng = Worksheets("LOTTI").Range("f1:f" & ur)
For Each cel In rng
If cel.Value = a Then
val = val & ", " & cel.Offset(0, 1).Value
End If
Next cel
Lotti = stringa & val
End Function |
