Pasting

J

Jim Berglund

I get a 1004 error code that states that the PasteSpecial Method of Range
Class Failed with the following

Columns("C:C").Select
Application.CutCopyMode = False
Selection.Copy
Range("E1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Is there a way to fix this?

Jim
 
G

Gary Keramidas

here are 3 differsnt ways, pick the one you want to use.

Sub test()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
ws.Columns("E").Value = ws.Columns("C").Value
End Sub


Sub test1()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
ws.Columns("C:C").Copy
ws.Range("E1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub


Sub test2()
Dim lastrow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "C").End(xlUp).Row
ws.Range("E1:E" & lastrow).Value = ws.Range("C1:C" & lastrow).Value
End Sub
 
J

Jim Berglund

Gary, I received your recoded application and was delighted with it. It
taught me a couple of new ways to think about the problem, and offered a
variety of new approaches that I'd have never considered (previously)

Thanks so much for your terrific support!
Jim
 

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