View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] harteorama@googlemail.com is offline
external usenet poster
 
Posts: 24
Default VBA Code for deleting rows with specific value


Hi Robert,

Try this... assume the data is in sheet1 (change as you like),

amend this row if you want to delete different columns ("A") and data
="EE").

If Cells(R, "A").Value = "EE)" Then .Rows(R).Delete

Sub DeleteRowEE()

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select

Dim R As Long
With Worksheets("Sheet1")
For R = .UsedRange.Rows.Count To 1 Step -1
If Cells(R, "A").Value = "EE)" Then .Rows(R).Delete
Next

End With
Application.ScreenUpdating = True

End Sub

Hopr it helps

P

Robert wrote:
Hi,

Can some one assist me with the following:
I want to create a macro that deletes all lines that contain a certain
value in column A.

For example
A
1 EE
2 EE
3 EE
4 EE
5 DD
6 DD
7 DD
8 DD
9 DD
10 DD

Does anyone knows which code to use for deleting all lines with "EE" om
column A?

All suggestions are mostly appreciated!

Thanks a lot

Regards,
Robert