Guest User

Untitled

a guest
Jul 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. 32984723987 BLA BLA &*& KEYWORD 232328 BLA
  2.  
  3. =VLOOKUP("*"&table2!A1&"*", table1!A:A, 1, FALSE)
  4.  
  5. Sub findKeywords()
  6.  
  7. Dim wb As Workbook
  8. Dim rWs, kWs As Worksheet
  9. Dim dataColumn, targetColumn, keysColumn As Integer
  10.  
  11. Set wb = ThisWorkbook
  12. Set rWs = wb.Sheets("rawSheet") 'this is the sheet your raw data is
  13. Set kWs = wb.Sheets("keySheet") 'this is your sheet with the keys
  14. dataColumn = 1 'this is the number of the column you will search
  15. targetColumn = 2 'this is the number of the column you will insert the matched row
  16. keysColumn = 1 'this is your column with the keywords you will look for
  17.  
  18. For Each r In rWs.range(rWs.Cells(1, dataColumn).Address, rWs.Cells(rWs.Rows.Count, dataColumn).End(xlUp).Address)
  19. For i = 1 To kWs.Cells(kWs.Rows.Count, keysColumn).End(xlUp).Row
  20. If r.Value Like "*" & kWs.Cells(i, keysColumn).Value & "*" Then
  21. r.Offset(0, 1).Value = kWs.Cells(i, keysColumn).Row
  22. End If
  23. Next i
  24. Next r
  25.  
  26. End Sub
Add Comment
Please, Sign In to add comment