ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste Failed (https://www.excelbanter.com/excel-programming/320210-paste-failed.html)

Nathan Bell

Paste Failed
 
All, I have this code and I cannot find out why it will not paste. I am
getting the following error when trying to run this macro "Runtime Error
1004: Paste method of worksheet class failed." Here is the code that I am
trying to run:

Sheets("CNP").Select
Columns("A:Z").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveSheet.Paste
Range("E:N,P:V,X:AC").Select
Selection.Delete Shift:=xlToLeft
Range("A1:F82").Select
Selection.Copy
Sheets("Daily").Select
Range("A2:F82").Select
Selection.ClearContents
Range("A2").Select
ActiveSheet.Paste
Range("A6:F83").Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("F5"), Order1:=xlDescending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("CNP").Select
Columns("B:E").Select
Selection.Delete Shift:=xlToLeft
Range("A:B").Select
Selection.Copy
Sheets("Data").Select
Dim rFound As Range
Set rFound = Sheet1.Cells.Find("*", _
Sheet1.Cells(1, 1), , , xlByColumns, xlPrevious)
If rFound Is Nothing Then
Range("A:B").Select
Else
rFound.Offset(0, 1).Resize(1, 2).EntireColumn.Select
End If
ActiveSheet.Paste
End Sub

It is failing on the second paste for some reason and I cannot figure out
why. Any help would be greatly appreciated.

Nathan Bell



Don Guillett[_4_]

Paste Failed
 
Gotta copy something before you can paste. Also, remove selections.

Sheets("CNP").Select
Columns("A:Z").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveSheet.Paste

============
Range("A1:F82").Copy Sheets("Daily").Range("A2")


--
Don Guillett
SalesAid Software

"Nathan Bell" wrote in message
...
All, I have this code and I cannot find out why it will not paste. I

am
getting the following error when trying to run this macro "Runtime Error
1004: Paste method of worksheet class failed." Here is the code that I am
trying to run:

Sheets("CNP").Select
Columns("A:Z").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveSheet.Paste
Range("E:N,P:V,X:AC").Select
Selection.Delete Shift:=xlToLeft
Range("A1:F82").Select
Selection.Copy
Sheets("Daily").Select
Range("A2:F82").Select
Selection.ClearContents
Range("A2").Select
ActiveSheet.Paste
Range("A6:F83").Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("F5"), Order1:=xlDescending,

Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("CNP").Select
Columns("B:E").Select
Selection.Delete Shift:=xlToLeft
Range("A:B").Select
Selection.Copy
Sheets("Data").Select
Dim rFound As Range
Set rFound = Sheet1.Cells.Find("*", _
Sheet1.Cells(1, 1), , , xlByColumns, xlPrevious)
If rFound Is Nothing Then
Range("A:B").Select
Else
rFound.Offset(0, 1).Resize(1, 2).EntireColumn.Select
End If
ActiveSheet.Paste
End Sub

It is failing on the second paste for some reason and I cannot figure out
why. Any help would be greatly appreciated.

Nathan Bell






All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com