Я хочу использовать оператор OR, чтобы моя функция говорила: «Если ячейка не начинается с« rw-promo »или« rw-content », то удалите всю строку.
Однако,функция не учитывает «rw-content», поэтому я остаюсь с клетками, начинающими с «rw-promo».
Любая помощь приветствуется!
Sub monthly_delete_emails()
'Disab;e certain Excel features, whilst the macro is running'
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Application.ScreenUpdating = False
'Declare variables'
Dim deleteRow As Long
Dim ws As Worksheet
'Set objects'
Set ws = ActiveSheet
'Loop through the rows of data, in order to delete rows with'
'a value in column B. Our macro starts at row 9'
For deleteRow = ws.Range("B" & Rows.Count).End(xlUp).Row To 9 Step -1
'identify values in col B, which start with ___'
If Not ws.Range("B" & deleteRow).Value Like "rw-promo*" Or ws.Range("B" & deleteRow).Value Like "rw-content*" Then
Rows(deleteRow).EntireRow.delete
End If
'Move to next cell in the range, which is being looped'
Next deleteRow
'Re-enable the above Excel features, which were disables whilst the macro ran'
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub