say I want code OK1 & OK2 information to be pulled from the input tab.
One way...
Sub J3v16()
Dim Data, Code, Temp, i As Long, ii As Long, x As Long
Data = Sheets("Input").Cells(1).CurrentRegion: Code = Array("OK1", "OK2")
ReDim Temp(1 To UBound(Data) * UBound(Data), 1 To 3)
For i = LBound(Code) To UBound(Code)
x = IIf(i = 0, x + 1, x + 2)
Temp(x, 1) = "Code": Temp(x, 2) = Code(i)
x = x + 1: Temp(x, 2) = "Ticker": Temp(x, 3) = "Type"
For ii = 2 To UBound(Data)
If Data(ii, 7) = Code(i) Then
x = x + 1: Temp(x, 2) = Data(ii, 1): Temp(x, 3) = Data(ii, 10)
End If
Next ii
Next i
Sheet2.Range("A" & Rows.Count).End(xlUp).Resize(x, 3).Value = Temp
End Sub
Bookmarks