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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,215,073
Messages
6,122,975
Members
449,095
Latest member
Mr Hughes

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