deleting rows which includes some words

aaaaa34

Board Regular
Joined
Feb 25, 2014
Messages
62
hello my friends,


in my worksheet, i want to delete entire rows which includes "Corners, Yellow cards, Red Cards" words
also i want to delete upper and lower rows of that row which we delete (these rows don't need to include any specific word, just i need to delete them too).


pls have a look to my file. delete row, upper and lower rows also - Jumpshare
thanks a lot.
 
Thanks a lot Peter!!!
You and your codes are super

Now I request last edit in this code. I promise last edit in this post.
Finally, can you edit like this, please:
1- Row itself
2- One above
3- Two below
 
Last edited:
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
1- Row itself
2- One above
3- Two below
That is identical to the last circumstance except that rows below is reduced by 1, so these numbers have just been reduced by 1.

Rich (BB code):
Sub Remove1Above2Below()
  Application.ScreenUpdating = False
  Rows("1:2").Insert
  With Range("A2", Range("A" & Rows.Count).End(xlUp))
    .Cells(1).Value = "x"
    .Cells(2, 2).Formula = "=SUMPRODUCT(--(A1:A4={""Corners"",""Yellow Cards"",""Red Cards""}))=0"
    .AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=.Cells(1, 2).Resize(2), CopyToRange:=.Cells(1, 3), Unique:=False
  End With
  Columns("A:B").Delete
  Rows("1:2").Delete
  Columns("A").AutoFit
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
That is identical to the last circumstance except that rows below is reduced by 1, so these numbers have just been reduced by 1.

Until now, you have always written great codes here, Mr. Moderator.
And I am endlessly thankful for them, Peter.

I'm still failing with my work. So, I'd like to request a few edits in this code:

Again code, will search only A column and will delete entire row. But this time,

a- Code needs to run when it finds any specific letter, word, or any symbol of that cell questioned in A column. In order to run it, searching word, letter or symbol doesn't have to match with whole content of that cell. Code will search "card" word and then it will delete rows where any cell has "yellow cards" , "red cards" , "pink cards" , etc

b- Second and final edit, this time code will not delete any above or below row. It will delete only that questioned row itself.

Please, download and have a look to new file, Mr. Moderator.
You'll see everything when you opened file: http://jumpshare.com/v/XCbTHs3zNgD6Iut6YHCu

Thank you.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,215
Members
453,024
Latest member
Wingit77

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