help with hide or delete

A

acarril

i have the following code to hide rows based on specific text:
Sub search()
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Range("A12:A5000")
If cell.Value = "RTRSSTCK" Then
cell.EntireRow.Hidden = True
ElseIf cell.Value = 1 Then
cell.EntireRow.Hidden = False
End If
Next
Application.ScreenUpdating = True
End Sub

How would i change the code to delete the row with the text and shif
everything else up
 
N

Norman Jones

Hi Aacarril.,

Ok, you want to *delete* rows where the column A value is "RTRSSTCK and you
want to *hide* rows where the column A value =1 ?

In your code replace the line:
cell.EntireRow.Hidden = True
with:

cell.EntireRow.delete
 
N

Norman Jones

Just a warning: the replacement line should not include the greater than
(>)symbol!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top