I have been using a scripting dictionary to extract values in column B based on whether the value in column matches a certain criteria.
I would now like to extract the value in column C as well as B (if A matches vCriteria) and then paste in the same format- currently it transposes into a one-column list- I need to column B & C values to stay adjacent.
here's the current code:
Set oDic = CreateObject("Scripting.Dictionary")
With Sheets("ExP")
vData = .Range("A2:B" & .Cells(.Rows.Count, "A").End(xlUp).Row).Value
End With
For i = 1 To UBound(vData, 1)
If vData(i, 1) = vCriteria2 Then
If Not oDic.Exists(CStr(vData(i, 2))) Then oDic.Add CStr(vData(i, 2)), vData(i, 2)
End If
Next i
If oDic.Count Then
vItems = oDic.items
With Sheets("Search").Range("F11").Resize(oDic.Count, 1)
.Value = Application.Transpose(vItems)
If Not Sheets("Search").Range("F12").Value = "" Then
.Sort key1:=.Cells(1), Header:=xlNo
End If
End With
End If
End If
thanks guys
Bookmarks