Hi All,
I need to exclude rows from ie sheet1.Range(A1:A200) which contain keywords from cells in sheet2.Range("I2:I50").
At the moment I am using array but I want the words to be taken from range in case user what to change these keywords.
Could anyone help me with this?
Thank you
Code which uses array
Sub test()
....
Dim arrWords
Dim rng as Range
Dim xlCalc As XlCalculation
arrWords = Array("A","B","C") ' edit the array as required
xlCalc = Application.Calculation
Set rng = Range("A1:A200")
For rw = rng.Rows(rng.Rows.Count).Row To rng.Rows(1).Row Step -1
For j = 0 To UBound(arrWords)
If InStr(1, rng(rw, 1), arrWords(j), vbTextCompare) Then
bDel = True
rng.Parent.Rows(rw).EntireRow.Delete
Exit For
End If
Next
Next
Application.Calculation = xlCalc
....
End Sub
I need to exclude rows from ie sheet1.Range(A1:A200) which contain keywords from cells in sheet2.Range("I2:I50").
At the moment I am using array but I want the words to be taken from range in case user what to change these keywords.
Could anyone help me with this?
Thank you
Code which uses array
Sub test()
....
Dim arrWords
Dim rng as Range
Dim xlCalc As XlCalculation
arrWords = Array("A","B","C") ' edit the array as required
xlCalc = Application.Calculation
Set rng = Range("A1:A200")
For rw = rng.Rows(rng.Rows.Count).Row To rng.Rows(1).Row Step -1
For j = 0 To UBound(arrWords)
If InStr(1, rng(rw, 1), arrWords(j), vbTextCompare) Then
bDel = True
rng.Parent.Rows(rw).EntireRow.Delete
Exit For
End If
Next
Next
Application.Calculation = xlCalc
....
End Sub