"The Paste method of the Worksheet class failed."

Solved
Armandra Posted messages 4 Status Member -  
Armandra Posted messages 4 Status Member -
Hello everyone,

I'm encountering a simple VBA error during an ActiveSheet.Paste. Here is my code:
 Dim Cel_reso As Range Set Cel_reso = Cells.Find(What:="Resolution") If Not Cel_reso Is Nothing Then Cells(1, Cel_reso.Column).Resize(Cells(Rows.Count, Cel_reso.Column).End(xlUp).Row).Cut Columns("A:A").Insert Shift:=xlToRight Range("A1").Select ActiveSheet.Paste End If


And the error occurs on "ActiveSheet.Paste"

Thanks in advance for your help everyone!

2 answers

Gyrus Posted messages 3360 Status Member 526
 
Hello,

The following code is sufficient:

Dim Cel_reso As Range
Set Cel_reso = Cells.Find(What:="Resolution")
If Not Cel_reso Is Nothing Then
Cells(1, Cel_reso.Column).Resize(Cells(Rows.Count, Cel_reso.Column).End(xlUp).Row).Cut
Columns("A:A").Insert Shift:=xlToRight
Range("A1").Select
End If


See you!
2
Armandra Posted messages 4 Status Member
 
It works perfectly, thank you very much!

Have a great day.
0