Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Paste method error in macro

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 638
Default Paste method error in macro

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

bwilk77 wrote:
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


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Paste method error in macro

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,




"JW" wrote:

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

bwilk77 wrote:
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PasteSpecial Method Error PW11111 Excel Discussion (Misc queries) 1 December 19th 06 01:24 PM
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
error running a paste macro Redskinsfan Excel Worksheet Functions 1 August 7th 06 08:02 PM
Effective method to paste array formula kuansheng Excel Worksheet Functions 2 February 2nd 06 12:47 AM
Method 'Paste' of object '_Worksheet' failed markline Excel Discussion (Misc queries) 7 May 28th 05 05:02 AM


All times are GMT +1. The time now is 04:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"