Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Deleting rows if cell contains text

Avatar of Jase Alexander
Jase AlexanderFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft OfficeMicrosoft ExcelVBA
4 Comments1 Solution116 ViewsLast Modified:
HI Guys

Hope you can help

I have a simple to do list sheet detailing live and completed tasks. Each task has a progress bar on the right and in this, is a conditional format set so when the 'x' key is used, the cell turns green signifying progress.

Ive tried the below code so that if the button is pressed, it scans the sheet in column N and if it finds an 'x' in the cells in Column N, it will hide the row as the task is, in effect, complete.

The code ive assembled is as follows :-

Sub HideRows()
    Dim cell As Range
    Dim DataCount As Integer
    With Worksheets("ToDoList")
        DataCount = Range("A" & Rows.Count).End(xlUp).Row
        For Each cell In Range("N1:N" & DataCount)
            If cell.Contains("x")  Then
                Range(cell.Row).EntireRow.Hidden = True
            End If
        Next cell
    End With
End Sub

However, Im getting an error and not sure what I am doing wrong?

I have attached the sheet - any suggestions and help would be appreciated

J
ToDoList.xlsm
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers