I am having some troubles with the code below. This code work very well when I was deleting rows <> 5.
'Deletes all Rows that <> 5
Dim x As Integer
For x = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).Rows.Count To 2 Step -1
If Cells(x, 1).value <> "5" Then Cells(x, 1).EntireRow.Delete Shift:=xlUp
Next x
This is a large spreadsheet going from A1 to AU15000. I'm deleting rows in column AT1:AT that have <> "submitted"...deleting rows containing "purged"
However, when I replace the values with text (purged or submitted) I have no success:
If Cells(x, 1).value <> "purged" ...all of the rows are deleted. There are only two words in the column (AU1:AU15000). They are either "purged" or "submitted".
I've used text instead of 'value' and I have tried 'text'. Maybe I should declare x as Variant?
I'm fairly certain that the value/format is incorrect.
---Current Code---
'Deletes all Rows that <> "submitted"
Dim x As Integer
For x = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).Rows.Count To 2 Step -1
If Cells(x, 1).Text <> "submitted" Then Cells(x, 1).EntireRow.Delete Shift:=xlUp
Next x
Any indeas?
'Deletes all Rows that <> 5
Dim x As Integer
For x = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).Rows.Count To 2 Step -1
If Cells(x, 1).value <> "5" Then Cells(x, 1).EntireRow.Delete Shift:=xlUp
Next x
This is a large spreadsheet going from A1 to AU15000. I'm deleting rows in column AT1:AT that have <> "submitted"...deleting rows containing "purged"
However, when I replace the values with text (purged or submitted) I have no success:
If Cells(x, 1).value <> "purged" ...all of the rows are deleted. There are only two words in the column (AU1:AU15000). They are either "purged" or "submitted".
I've used text instead of 'value' and I have tried 'text'. Maybe I should declare x as Variant?
I'm fairly certain that the value/format is incorrect.
---Current Code---
'Deletes all Rows that <> "submitted"
Dim x As Integer
For x = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).Rows.Count To 2 Step -1
If Cells(x, 1).Text <> "submitted" Then Cells(x, 1).EntireRow.Delete Shift:=xlUp
Next x
Any indeas?