Com dados como:
Comoexecutarestamacro:
SubprodList()DimcustAsString,rLookAsRange,msgAsStringDimctAsVariant,rAsRangecust=Application.InputBox(Prompt:="Enter Customer Name", Type:=2)
Set rLook = Range("1:1").Find(What:=cust, After:=Range("A1")).EntireColumn
msg = ""
For Each r In rLook.Cells
pr = Cells(r.Row, 1).Value
If pr = "" Then Exit For
ct = CStr(r.Value)
If ct <> "" Then
msg = msg & vbCrLf & pr & vbTab & ct
End If
Next r
MsgBox msg
End Sub
Será exibido:
EDIT#1:
ParaarmazenarasaídaemFolha2useestamacro:
SubprodList2()DimcustAsString,rLookAsRange,KAsLongDimctAsVariant,rAsRangecust=Application.InputBox(Prompt:="Enter Customer Name", Type:=2)
Set rLook = Range("1:1").Find(What:=cust, After:=Range("A1")).EntireColumn
K = 1
For Each r In rLook.Cells
pr = Cells(r.Row, 1).Value
If pr = "" Then Exit For
ct = CStr(r.Value)
If ct <> "" Then
Sheets("Sheet2").Cells(K, 1) = pr
Sheets("Sheet2").Cells(K, 2) = ct
K = K + 1
End If
Next r
End Sub