[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.4

Delete rows with certain text strings in a cell

Asked by dogztar in Microsoft Excel Spreadsheet Software

Tags: excel, delete, rows, certain, text

Hey all...

OK, so here is my issue.  I want to write a macro (and have it available in any Excel file I open) that will "walk" row-by-row through a XL sheet, checking the .Value of the cell in Column 9 and if one of several text strings is found in that cell, delete the entire row.  (This is to process/cleanup a virus report generated by our anti-virus monitoring server, basically I want to get rid of any entries where the virus was cleaned or Quarantined, or if the entry is a duplicate of the previous line).
The columns/sample data are labeled as such:
Computer name   Scan Type   Date   Time   Login name   Infected file   Directory   Virus name   Action
GEMELO1C      Real-time Scan      20040206      204112      GEMELO1      i.exe      c:\      TROJ_SMALL.AC      Virus successfully detected, cannot perform the Clean action (Virus successfully detected, cannot perform the Quarantine action)
GPDELL-1      Real-time Scan      20040203      83959      GPDELL      x.exe      C:\      TROJ_SMALL.AR      Virus successfully detected, cannot perform the Clean action (Quarantine)
(Hopefully the formatting isn't too screwed up on that)
The Action column (9) is the one I'm interested in here.

The code I have is this:

Sub CleanTrendReport()
   rowx = 1    ' Start in the first row
   col = 9     ' The column to look for duplicates in the sheet
   Const sQuarantine = "Virus successfully detected, cannot perform the Clean action (Quarantine)"
   Const sClean = "Clean"
   Application.ScreenUpdating = False

   Do Until Cells(rowx + 1, col).Value = ""    ' Loop until end of data
      If Cells(rowx, col).Value = Cells(rowx + 1, col).Value _
         Or Cells(rowx, col).Value = sClean Or Cells(rowx, col).Value = sQuarantine Then
'            MsgBox "Column I value at row " & rowx & " is: " & Cells(rowx, col).Value
            Cells(rowx + 1, col).EntireRow.Delete
      Else
         rowx = rowx + 1 ' Increment to next row
      End If
   Loop
   Beep
   Application.ScreenUpdating = True
End Sub
-------------------
If I remove the comment on the MsgBox function above, it seems like it gets stuck there after the Else statement, and will keep popping up showing the same row; for some reason rowx is never incremented.  Does anyone see the error of my ways?  I'm definitely a beginning VBA programmer, but have a good deal of programming experience in other languages.

Thanks.

dogztar

[+][-]02/11/04 01:43 AM, ID: 10330647Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: excel, delete, rows, certain, text
Sign Up Now!
Solution Provided By: ture
Participating Experts: 4
Solution Grade: A
 
[+][-]02/10/04 12:08 PM, ID: 10325683Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/10/04 12:10 PM, ID: 10325704Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/10/04 11:31 PM, ID: 10330096Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/11/04 01:42 AM, ID: 10330639Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/11/04 03:04 AM, ID: 10331067Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/11/04 03:08 AM, ID: 10331087Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/11/04 05:51 AM, ID: 10332050Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/11/04 05:52 AM, ID: 10332058Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/11/04 06:02 AM, ID: 10332133Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92