COPY > PASTE (macro)

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
Why doesn't work this macro?
I receive an error message on the line :
Range("A5").PasteSpecial

This is my macro :

Sub Filter()
currentworkbook = ActiveWorkbook.Name
currentsheet = ActiveSheet.Name
Columns("L:L").Select
Selection.autofilter Field:=1, Criteria1:="1"
Range("A5:" & Range("K65536").End(xlUp).Address).Copy
Workbooks.OpenText Filename:="G:Mijn documentenMap1.xls"
Sheets("Blad1").Select
Range("A5").PasteSpecial
Workbooks(currentworkbook).Sheets(currentsheet).Activate
Selection.autofilter
Range("A1").Select
End Sub

Many thanks for help.
 
On 2002-04-19 06:44, Tommy Bak wrote:
Hi verluc.
I've changed your macro a couple of places.
Now it seems to run well.

Sub Filter()
currentworkbook = ActiveWorkbook.Name
currentsheet = ActiveSheet.Name
Columns("L:L").Select
Selection.AutoFilter Field:=1, Criteria1:="1"
Set kopi = Range("A5:" & Range("K65536").End(xlUp).Address)
Workbooks.OpenText Filename:="G:Mijn documentenMap1.xls"
Cells.Clear
kopi.Copy
Range("A5").Select
ActiveSheet.Paste
Workbooks(currentworkbook).Worksheets(currentsheet).Activate
Selection.AutoFilter
Range("A1").Select
End Sub
Great Tommy,now it works all.
Many,Many thanks
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
Latest member
greyangel23

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