Copying and pasting values error 1004

A

alistair01

Whenever i run this piece of code i get the error
"paste method of worksheet class failed" runtime error 1004
This is in excel 2003 and i did not have this problem in 2000. Coul
anyone shed any light on this??

Range("A1").Select
Sheets("atl").Select
Range("A1").Select
Selection.AutoFilter Field:=9
Selection.AutoFilter Field:=8
Selection.AutoFilter Field:=11
Selection.AutoFilter Field:=9, Criteria1:="1"

Selection.AutoFilter Field:=13, Criteria1:="3"
Columns("J:J").Select

Range("J:J,B:B").Select
Selection.Copy
Sheets("Alarm Type-Door").Activate
Range("a1").Select
ActiveSheet.Paste
Columns("A:A").EntireColumn.AutoFit
Columns("B:B").EntireColumn.AutoFit
Range("A1").Select

When i enter the vb editor the line activesheet.paste is highlighte
which i presume is where the error is
 
I

icestationzbra

i cannot provide a solution, as i am at a computer with xl 2000, right
now.

some functionalities have changed between xl 2000 and the following
version.

i can suggest a solution.

record a macro in which you simple copy something from one sheet onto
another. compare the code with your code, this will give you an idea as
to what is the correct syntax for 'paste'.
 
D

Don Guillett

try removing your un-necessary selections.
with Sheets("Alarm Type-Door")
Range("J:J,B:B").Copy .Range("a1")
..columns("A:b").EntireColumn.AutoFit
end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top