Hello.....
I have code that works well to use a value in each row in a column in WS1 and compare it to a list of names in WS2 and if there is a match, put the value in WS2 A1 into Cell O of WS1 (offset 11 columns). What I want to do is make this an "OR" and compare to WS2 range A2:A14 OR WS2 C2:C26. If there was a match in the range in column A it would return the value in A1 and if there was a match to the range in Column C it would return the value in C1.
Thanks for any help....
I have code that works well to use a value in each row in a column in WS1 and compare it to a list of names in WS2 and if there is a match, put the value in WS2 A1 into Cell O of WS1 (offset 11 columns). What I want to do is make this an "OR" and compare to WS2 range A2:A14 OR WS2 C2:C26. If there was a match in the range in column A it would return the value in A1 and if there was a match to the range in Column C it would return the value in C1.
Thanks for any help....
Code:
Sub Find_Category()
Dim Cl As Range, c2 As Range
Dim Ws1 As Worksheet, Ws2 As Worksheet
Set Ws1 = Sheets("FG Report")
Set Ws2 = Sheets("Posting Names")
With CreateObject("scripting.dictionary")
For Each Cl In Ws2.Range("A2:A14")
.Item(Cl.Value) = Ws2.Range("A1").Value
Next Cl
For Each Cl In Ws1.Range("D3", Ws1.Range("D" & Rows.Count).End(xlUp))
Cl.Offset(, 11).Value = .Item(Cl.Value)
Next Cl
End With
End Sub