Thread: Pasting
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas[_4_] Gary Keramidas[_4_] is offline
external usenet poster
 
Posts: 226
Default Pasting

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


--


Gary Keramidas
Excel 2003


"Jim Berglund" wrote in message
...
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