Entire Row Delete - How to use in i Sheet 2? See function

NeewBie

New Member
Joined
Aug 7, 2012
Messages
40
Hi,

I wonder how I can use the function downside on sheet 2 and not in sheet 1. Can someone please help me?

Set SrchRng = ActiveSheet.Range("A1", ActiveSheet.Range("A632").End(xlUp))
Do
Set myRange = SrchRng.Find("XYXYXYXY", LookIn:=xlValues)
If Not myRange Is Nothing Then myRange.EntireRow.Delete
Loop While Not myRange Is Nothing

Cheers!!!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi Neewbie, welcome to the forum.

Does this help:
Rich (BB code):
Set SrchRng = ActiveSheets("Sheet2").Range("A1", ActiveSheet.Range("A632").End(xlUp))
    Do
        Set myRange = SrchRng.Find("XYXYXYXY", LookIn:=xlValues)
        If Not myRange Is Nothing Then myRange.EntireRow.Delete
    Loop While Not myRange Is Nothing

Regards
 
Upvote 0
Hmmm, Thanks Andrew - i really ought to read more carefully!
 
Upvote 0
Thanks for the respons! I have try this but still dont work. I have alot of loops in the script that after dubuggingg the result writes in sheet 2. Where in the script schould I place the this script:


Set SrchRng = ActiveSheets("Sheet2").Range("A1", ActiveSheet.Range("A632").End(xlUp)) Do Set myRange = SrchRng.Find("XYXYXYXY", LookIn:=xlValues) If Not myRange Is Nothing Then myRange.EntireRow.Delete Loop While Not myRange Is Nothing
</pre>
 
Upvote 0
Did you try?

Code:
Set SrchRng = Worksheets("Sheet2").Range("A1", Worksheets("Sheet2").Range("A632").End(xlUp))
Do
    Set myRange = SrchRng.Find("XYXYXYXY", LookIn:=xlValues)
    If Not myRange Is Nothing Then myRange.EntireRow.Delete
Loop While Not myRange Is Nothing
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top