View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson Greg Wilson is offline
external usenet poster
 
Posts: 747
Default copy only value and not formula

Don't know what you're trying to do, but this does pretty much what your
macro does without the selection and PasteSpecial. Maybe it's a step in the
right direction?

Sub Test()
Dim rw As Long
rw = Cells(Rows.Count, 5).End(xlUp).Row + 1
With Range("A1:A5")
.Value = .Value
Cells(rw, 5).Resize(5, 1).Value = .Value
End With
End Sub

Greg




"ramzi" wrote:

hi,

Below is my macro....
if my data only at A1 to A3, but A4 and A5 still have program (e.g =b4*b5),
how to copy only value (data) without copy the formula inside A4 and A5. So
for the next copy , it will start paste at E4 instead of E6.


Range("A1:A5").Select
Selection.Copy
Range("E1").Select
lastrow = Sheets("sheet1").Cells(Cells.Rows.Count, "E").End(xlUp).Row + 1
Sheets("Sheet1").Range("e" & lastrow).PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("C7").Select
Application.CutCopyMode = False

rgds
Ramzi