Delete Selection Following Filter

rfletcher35

Active Member
Joined
Jul 20, 2011
Messages
300
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

I was very helpfully assisted earlier with a bit of alternative coding to what I was using. However in using this I have now hit another snag. I have attached a section of my code below which filters certain keywords then copies them into the correct sheet, once it has pasted the required I need it to delete the selection. Can anyone help please?

Dim ar As Variant, i As Integer
Dim ws As Worksheet: Set ws = ActiveSheet '---->The best option here is to use the sheet code.
ar = Array("Inbox", "Whitelist", "Diary", "Email", "Outlook", "Spam", "Mailbox", "inbox", "Calendar", "Diaries") '---->Add to the array as required.


For i = 0 To UBound(ar)
With ws.Range("C1", Range("C" & Rows.Count).End(xlUp))
.AutoFilter 1, "*" & ar(i) & "*"
.Offset(1).EntireRow.Copy Sheets("Emails").Range("A" & Rows.Count).End(3)(2)

End With

'Range("A1:G100000").Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
Next i

ar = Array("Starter", "Login", "Offb", "Leav", "User", "New Joiner", "Set Up", "Licen") '---->Add to the array as required.
For i = 0 To UBound(ar)
With ws.Range("C1", Range("C" & Rows.Count).End(xlUp))
.AutoFilter 1, "*" & ar(i) & "*"
.Offset(1).EntireRow.Copy Sheets("Users").Range("A" & Rows.Count).End(3)(2)

End With
Next i

ar = Array("Inbox", "Internet", "Wifi", "Website") '---->Add to the array as required.
For i = 0 To UBound(ar)
With ws.Range("C1", Range("C" & Rows.Count).End(xlUp))
.AutoFilter 1, "*" & ar(i) & "*"
.Offset(1).EntireRow.Copy Sheets("Internet").Range("A" & Rows.Count).End(3)(2)

End With

Thanks

Fletch
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hello Fletch,

It's been answered for you in your last thread.

Cheerio,
vcoolio.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,025
Messages
6,122,731
Members
449,093
Latest member
Mnur

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