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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
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,223,248
Messages
6,171,011
Members
452,374
Latest member
keccles

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