Delete specific rows with specific words in cells to another table

Stacy Rueda

Board Regular
Joined
Jun 23, 2016
Messages
87
Hi everyone,

I have super urgent project. This is very simple, but as a beginner like me, I don't know how to modify code that I have found in this forum. I've searched it all (but if you find forum regarding this, kindly reply with link in it) but all thread we're asking delete rows in active sheet only, But in my case, I want to delete rows with specific words to another worksheets ("Data"). Can you help me what is wrong for below code, please. Btw, I used command button to delete rows.
The rows to deleted will be "The power of machine was turned on and The power of machine was turned off".

Code:
 Sub Button2_Click()

This Workbook "Data"
    .AutoFilterMode = False
    With Range("F1", Range("F" & Rows.Count).End(xlUp))
        .AutoFilter 1, "*The power of machine was turned*"
        On Error Resume Next
        .Offset(1).SpecialCells(12).EntireRow.Delete
    End With
    .AutoFilterMode = False
End With
End Sub

Thank you so much
 
Last edited by a moderator:

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
You're missing the . from infront of the 2 ranges
Code:
With .Range("F1", .Range("F" & Rows.Count).End(xlUp))
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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