Ошибка: метод 'Range' объекта'_Worksheet 'не выполнен
Dim Ws As Worksheet
For Each Ws In Sheets(Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"))
Ws.Range("I9:AM68" & Rows.Count).Replace What:="AP", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="BL", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="MA", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="PA", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="PL", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="SL", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="UP", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="H1", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="H2", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="TR", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="WH", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="NJ", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="AL", Replacement:="", LookAt:=xlWhole
Ws.Range("I9:AM68" & Rows.Count).Replace What:="SUP", Replacement:="", LookAt:=xlWhole
Next Ws
Если на каждом листе найдено совпадение, данные очищаются => имеют условное форматирование в диапазоне => от I до AM
Это мой другой код, который я пробовал не работать
Dim Ws As Worksheet, lr As Long, c As Range
For Each Ws In Sheets(Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"))
lr = Ws.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row
For Each c In Ws.Range("I9:AM68" & lr)
Select Case UCase(c.Value)
Case "SUP", "AP", "AL"
c.Value = ""
c.Interior.ColorIndex = xlNone
End Select
Next
Next Ws
Это изображение моего Excel
[мое изображение] [1]: https://i.stack.imgur.com/yDLj4.png
Это ниже Работает нормально для меня, но не для установки цвета ячейки на нормальный цвет ячейки, как без цвета заливки
'what:=UCase("SUP"), Replacement:="", ReplaceFormat:=True
Dim Ws As Worksheet
For Each Ws In Sheets(Array("Sheet1", "Sheet2", "Sheet3"))
Ws.Range("A4:K" & Rows.Count).Replace what:=UCase("SUP"), Replacement:="", ReplaceFormat:=True
Ws.Range("A4:K" & Rows.Count).Replace what:=UCase("SUP"), Replacement:="", ReplaceFormat:=False
Ws.Range("A4:K" & Rows.Count).Replace what:=UCase("AP"), Replacement:="", ReplaceFormat:=True
Ws.Range("A4:K" & Rows.Count).Replace what:=UCase("AP"), Replacement:="", ReplaceFormat:=False
Ws.Range("A4:K" & Rows.Count).Replace what:=UCase("AL"), Replacement:="", ReplaceFormat:=True
Ws.Range("A4:K" & Rows.Count).Replace what:=UCase("AL"), Replacement:="", ReplaceFormat:=False
Next Ws
это ниже вывода вышеуказанного кода
[вывод] [1]: https://i.stack.imgur.com/H09ab.png