Need macro that removes rows containing values

champchamp

New Member
Joined
Jan 22, 2020
Messages
6
Office Version
  1. 2016
I have an excel file that looks like this:

www.mysite.com
www.mysite.com/article-1/
www.mysite.com/article-2/
www.mysite.com/article-3/
www.mysite.com/article-1/
www.mysite.com/113/

I want to accomplish two things.

1) Remove rows containing no "/" sign or only one "/' sign.
In our case it's only the first row that does not have a "/" in it. All others have at least 2 x "/".

2) Remove rows containing certain values:
For example remove all rows that have the words "1" or "2" in them.
This means that that the row "www.mysite.com/113/" will also get removed as it has the "1" in it.


For my second question I have this code, but the problem is that it only removes absolute values. I would have to add the whole value to get it removed (i.e "www.mysite.com/article-1/" or remove "www.mysite.com/article-1/", but my goal is to remove all rows that have the numer "1" in it).

VBA Code:
Sub MultiDelete()
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
Range("A1").Activate 'change to suit the column containing the names
Dim MultiDelete
MultiDelete = Array("1", "2", "3") 'put as many names as you like in the array
Dim G As Variant
While ActiveCell.Value <> ""
 G = Filter(MultiDelete, ActiveCell.Value)
 If UBound(G) <> -1 Then
 Selection.EntireRow.Delete
 Else
 ActiveCell.Offset(1, 0).Activate
 End If
Wend
With Application
.ScreenUpdating = True
.DisplayAlerts = True
End With
End Sub

Any ideas?
 

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.
I forgot an important factor.
I have a list with hundreds of rows.

So it would be nice to get the values from a spreadsheet and remove everything on another spreadsheet because I wouldn't be able to add values to a macro like this: "value1" , "value 2" etc.
 
Upvote 0

Forum statistics

Threads
1,214,424
Messages
6,119,404
Members
448,893
Latest member
AtariBaby

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