rfletcher35
Active Member
- Joined
- Jul 20, 2011
- Messages
- 300
- Office Version
- 365
- Platform
- 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
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