Link to home
Start Free TrialLog in
Avatar of carlosab
carlosab

asked on

Simple Excel VBA

I have a worksheet with a number of rows that will vary. I need a routine to delete all rows that do not have either an 11 or a 45 in the first cell of the row. The routine needs to stop when it gets to a blank row.
Avatar of Dave
Dave
Flag of Australia image

In Column A?

A sample would help clarify yur questio

Cheers

Dave
Avatar of carlosab
carlosab

ASKER

Yes, Column A. Here is a sample. Also, I need the script to delete any row where Column C does not start with CV. Thanks!
3      03-1-04      CV-0000059-11
3      03-1-04      CV-0000059-11
3      03-1-04      CV-0000060-11
11      11-1-01      CV-0000107-11
11      11-1-01      CV-0000108-11
11      11-1-01      CV-0000109-11
11      11-1-01      LT-0000098-11
43      43-3-02      LT-0000071-11
43      43-3-03      CV-0000043-11
43      43-3-03      CV-0000044-11
43      43-3-03      CV-0000045-11
43      43-3-03      CV-0000047-11
43      43-3-03      CV-0000047-11
45      45-1-05      LT-0000088-11
45      45-1-05      LT-0000089-11
45      45-1-05      LT-0000090-11
45      45-1-05      LT-0000090-11
ASKER CERTIFIED SOLUTION
Avatar of Dave
Dave
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is my dataset before running your code:

3      3/1/2004      CV-0000059-11
3      3/1/2004      CV-0000059-11
3      3/1/2004      CV-0000060-11
11      11/1/2001      CV-0000107-11
11      11/1/2001      CV-0000108-11
11      11/1/2001      CV-0000109-11
11      11/1/2001      LT-0000098-11
43      43-3-02      LT-0000071-11
43      43-3-03      CV-0000043-11
43      43-3-03      CV-0000044-11
43      43-3-03      CV-0000045-11
43      43-3-03      CV-0000047-11
43      43-3-03      CV-0000047-11
45      45-1-05      LT-0000088-11
45      45-1-05      LT-0000089-11
45      45-1-05      LT-0000090-11
45      45-1-05      LT-0000090-11


This is the remaining data after I run it:

11      11/1/2001      CV-0000107-11
11      11/1/2001      CV-0000108-11
11      11/1/2001      CV-0000109-11


Sorry, I didn't realize that 45 was all LT in the 3rd column. Code works perfect. Thanks!
thx for the grade :)