ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with hide or delete (https://www.excelbanter.com/excel-programming/305092-help-hide-delete.html)

acarril[_5_]

help with hide or delete
 
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

--
Message posted from http://www.ExcelForum.com


Norman Jones

help with hide or delete
 
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



---
Regards,
Norman



"acarril " wrote in message
...
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 shift
everything else up?


---
Message posted from http://www.ExcelForum.com/




Norman Jones

help with hide or delete
 
Just a warning: the replacement line should not include the greater than
()symbol!

---
Regards,
Norman



"Norman Jones" wrote in message
...
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



---
Regards,
Norman




acarril[_6_]

help with hide or delete
 
Thanks Norman that was great

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com