Thread: Delete Rows
View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.newusers
Bernie Bernie is offline
external usenet poster
 
Posts: 20
Default Delete Rows

Actually they all didn't work. I am looking for all new code that
works. :)

Thanks,
Bernie

Gord Dibben wrote:
Don't know where you have entered the code.

Did you plug it into the code provided by Gary's Student?

Post the code you're using.


Gord

On 29 Dec 2006 06:24:45 -0800, "Bernie" wrote:

Thank you. I get the error message of Run Time Error 438. What do I
do?

Bern

Gord Dibben wrote:
Or if many sheets in workbook may be easier to put the 5 you want into an array.

If many sheets you could put the 5 sheets in an array

For Each W In Worksheets(Array("sheet1", "Sheet3", _
"Sheet5", "sheet7", "sheet9"))


Gord Dibben MS Excel MVP

On Thu, 28 Dec 2006 15:00:00 -0800, Gary''s Student
wrote:

It is easier to list the sheets to avoid. Replace

If w.Name = "Sheet1" Then

with

If w.Name="Sheet1" or w.Name="avoid3" or w.Name="avoid9" Then
--
Gary''s Student


"Bernie" wrote:

I don't want it to look at all the sheets, just 5. How do I name them?

Bernie

Gary''s Student wrote:
Now I understand:

Sub remover2()
v = Sheets("Sheet1").Range("A1").Value
For Each w In Worksheets
If w.Name = "Sheet1" Then
Else
For Each r In w.UsedRange
If r.Value = v Then
r.EntireRow.Delete
Exit For
End If
Next
End If
Next
End Sub