Filter Cut Paste

Apple2_1979

Board Regular
Joined
Feb 17, 2012
Messages
56
Hi All,

I need a VBA solution. I need to filter column AL and paste the results to column AK. So far I have this,

Sub Macro7()
'
' Macro7 Macro
'
'
With ActiveSheet.Range("AL2:AL1859")
.AutoFilter Field:=38, Criteria1:= _
"=*isolat*", Operator:=xlAnd, Criteria2:="<>*isolation*"
On Error Resume Next
.SpecialCells(xlCellTypeVisible).Cut Range("AK2")
On Error GoTo 0

End With

End Sub

But it stops at the filter and does not cut then paste. Thank-you in advance.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Apple2_1979,

Try the following.
The Copy and ClearContents will only act on the visible filtered data.


Sub Macro7()
'
' Macro7 Macro
'
'
With ActiveSheet.Range("AL2:AL1859")
.AutoFilter Field:=38, Criteria1:= _
"=*isolat*", Operator:=xlAnd, Criteria2:="<>*isolation*"
On Error Resume Next

.Copy Destination:=Range("AK2")
.ClearContents
On Error GoTo 0

End With

End Sub

[/CODE]
Hope that helps.
 
Upvote 0
Thanks Snakehips, but...I need the filtered cut data pasted to the cell directly beside the cell it is comming from.
ie.
AL13 to AK13
AL15 to AL15
AL1855 to AK1855


etc...

Thanks for the quick response....cheers!
 
Upvote 0
Apple2_1979,

Try this. It will do what you want but might be sluggish on a large data set.

Code:
Sub Macro7()
'
' Macro7 Macro
'
'
With ActiveSheet.Range("AL2:AL1859")
.AutoFilter Field:=38, Criteria1:= _
"=*isolat*", Operator:=xlAnd, Criteria2:="<>*isolation*"
On Error Resume Next
[COLOR=blue]Set Rng = .SpecialCells(xlCellTypeVisible)
For Each Cell In Rng
Cell.Offset(0, 1).Value = Cell.Value
Cell.ClearContents
Next Cell[/COLOR]
On Error GoTo 0

End With

End Sub
 
Upvote 0
Hi Tony,

I really appreciated your assistance yesterday. You were quick, knowledgable and seemed understanding.

Thank-you again,

Phil (Apple2_1979)
:beerchug:
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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