Paste method error in macro

G

Guest

I have a macro that is trying to copy certain from one sheet and paste it
into a different sheet (both in the same workbook). For the most part this
is working, except when it is run on one specific computer, I get the error
1004 "Paste method of worksheet class failed". Why would this only happen on
one particular computer?

Here is the code that is erroring out.

Sheets("x").Select
Range("A1").Select
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Cells.Select
Cells.EntireColumn.AutoFit
Selection.AutoFilter Field:=22, Criteria1:="GR"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("GR_fast_movers_not_in_talls").Select
Range("A1").Select
ActiveSheet.Paste

Thanks, Brad
 
J

JW

Try something like this instead of all of those selects:
Sub test()
With Sheets("x")
.Columns(1).Delete Shift:=xlToLeft
With .Cells
.EntireColumn.AutoFit
.AutoFilter Field:=22, Criteria1:="GR"
.SpecialCells(xlCellTypeVisible).Copy _
Sheets("GR_fast_movers_not_in_talls") _
.Range("A1")
End With
.AutoFilterMode = False
End With
End Sub
 
G

Guest

This worked on my computer, but again I got an error on that particular PC.
This error was "Run time error: Copy method of range class failed"

This errored out at this line:
.SpecialCells(xlCellTypeVisible).Copy _
Sheets("GR_fast_movers_not_in_talls") _
.Range("A1")


Any thoughts???
Thanks,
 

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