ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Object Required (https://www.excelbanter.com/excel-programming/357187-object-required.html)

Chuck Neal

Object Required
 
Why do I get "Object Required" with this? What is wrong? I want to delete
every row that has "Red Prairie..." in the cell.

Sub DeleteRedPrairie ()
Dim lastrow as Long, i As Long
lastrow = Cells(Row.Count, 1) .End(x1Up) .Row
For 1 = lastrow To Step -1
If Cells(i,1) Value = "RedPrairie" Then
Rows(i).Delete
End If
Next
End Sub

I also want to be able to delete the row immediately below the on that
contains RedPrairie.

Please help....these rows are screwing up everything I do. Also due to
concatenate formulas I need to run, I cannot sort this first. Filtering
slows down my macros immensely.

Chuck

EvolBob

Object Required
 
Just a guess Chuck but is 'Red Prairie' the same as 'RedPrairie'?

I'd also suggest just tagging the cells with the red string with a formula =na()

For each c in [YourRange].cells
if c.value = "Red Prairie" then c.formula = "=NA()"
Next c
[YourRange].Specialcells(XLCellTypeFormulas,Xlerrors).EntireR ow.delete


Regards
Robert McCurdy

"Chuck Neal" wrote in message ...
Why do I get "Object Required" with this? What is wrong? I want to delete
every row that has "Red Prairie..." in the cell.

Sub DeleteRedPrairie ()
Dim lastrow as Long, i As Long
lastrow = Cells(Row.Count, 1) .End(x1Up) .Row
For 1 = lastrow To Step -1
If Cells(i,1) Value = "RedPrairie" Then
Rows(i).Delete
End If
Next
End Sub

I also want to be able to delete the row immediately below the on that
contains RedPrairie.

Please help....these rows are screwing up everything I do. Also due to
concatenate formulas I need to run, I cannot sort this first. Filtering
slows down my macros immensely.

Chuck


All times are GMT +1. The time now is 06:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com