Excel regular expression macro that will search one column for matches, paste the entire row of all matches in another worksheet

前端 未结 2 734
南旧
南旧 2021-02-11 02:25

I need to be able to use regular expressions in an excel macro that will search through a specific column, and then copy and paste all the rows that contain matches into a new s

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-11 02:43

    Without major changes to your existing sub. Replace:

    If Range("E" & CStr(LSearchRow)).Value = "Mail Box" Then
    

    with:

    v = Range("E" & CStr(LSearchRow)).Value
    If InStr(1, v, "red") > 0 Or InStr(1, v, "blue") > 0 Then
    

提交回复
热议问题