champchamp
New Member
- Joined
- Jan 22, 2020
- Messages
- 6
- Office Version
- 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).
Any ideas?
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?