VBA - Find text and Delete Entire Row in Multiple Sheet

billylui9

New Member
Joined
Feb 2, 2021
Messages
6
Office Version
  1. 2010
Platform
  1. Windows
Please HELP write a VBA to finding a Text in Multiple Sheet and delete the entire row if the text is found.

This String will appear many time,

I.e. if the string "BONNIE" is present in any cell in any string position in any Sheet the entire row will be deleted.

URGENT, Many thanks
 
I can't read the picture you posted
How many sheets do you have?
How many rows on Average do you have?
Can "Bonnie" be anywhere on the sheet, or is it in a specific column / s
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I can't read the picture you posted
How many sheets do you have?
How many rows on Average do you have?
Can "Bonnie" be anywhere on the sheet, or is it in a specific column / s
Sheet total almost 100
Around 120 rows per sheet
"Bonnie" could be indivual Text or in any string and no specific column
 
Upvote 0
In that case with so many sheets, try it this way
This code originally came from Rick Rothstein (y) (y)
VBA Code:
Sub MM1()
  Dim WS As Worksheet
  On Error Resume Next
  For Each WS In Sheets
    With WS.UsedRange
      .Replace "*Bonnie*", "#N/A", xlWhole, , False
      Intersect(.Cells, .SpecialCells(xlConstants, xlErrors).EntireRow).Delete
    End With
  Next
End Sub
 
Upvote 0
In that case with so many sheets, try it this way
This code originally came from Rick Rothstein (y) (y)
VBA Code:
Sub MM1()
  Dim WS As Worksheet
  On Error Resume Next
  For Each WS In Sheets
    With WS.UsedRange
      .Replace "*Bonnie*", "#N/A", xlWhole, , False
      Intersect(.Cells, .SpecialCells(xlConstants, xlErrors).EntireRow).Delete
    End With
  Next
End Sub
This code sometimes "#N/A" will leave behind on the cell, but its Help me lot, thanks
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,537
Members
449,088
Latest member
RandomExceller01

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