Check for strings in each cell and print strings in adjacent cell if they appear
Hello,
I'm trying to take each cell in column A and check to see if it contains any of the strings in tagList; then, if it does contain one, it should print a string in column B in the same row consisting of 'TAG1 & ", " & TAG2', etc, depending on which tags it contains.
This is what I have so far; I haven't done VBA in a long time so I'm sort of frankensteining other code snippets to build this out, and cant figure out the action to take at each step in the For loop.
According to your attachment as a beginner starter :
PHP Code:
Sub Demo1() Dim G, A$(), R&, S$(), V, W G = [G1].CurrentRegion.Rows("2:" & [G1].CurrentRegion.Rows.Count).Value2 With [A1].CurrentRegion.Rows ReDim A(2 To .Count, 0) For R = 2 To .Count S = Split(Replace(.Cells(R, 2).Value2, ",", "")) For Each V In G W = Application.Match(V, S, 0) If IsError(W) Then W = Application.Match(V & "S", S, 0) If IsNumeric(W) Then A(R, 0) = IIf(A(R, 0) > "", A(R, 0) & ", ", "") & V Next Next .Item("2:" & .Count).Columns(1).Value2 = A End With End Sub
► Do you like it ? ► ► So thanks to click on bottom left star icon « ★ Add Reputation » !
Bookmarks