Macro - Copy/Paste Problem

BigNick1

New Member
Joined
Feb 18, 2013
Messages
9
I'm using the below code to copy data between worksheets. All works well apart from the bold and italicised section which copies the formula across and not the calculated value. Any help will be great appreciated.

Sub CopyData()

Sheets("CustList").Select
' Find the last row of data
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
' Loop through each row
For x = 2 To FinalRow
' Decide if to copy based on column CA
ThisValue = Cells([x], "CA").Value
If ThisValue <> 0 Then
Cells([x], "A").Copy
Sheets("FinalList").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(NextRow, 1).Select
ActiveSheet.Paste
Sheets("CustList").Select

Cells([x], "B").Copy
Sheets("FinalList").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(NextRow, 2).Select
ActiveSheet.Paste
Sheets("CustList").Select

Cells([x], "C").Copy
Sheets("FinalList").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(NextRow, 3).Select
ActiveSheet.Paste
Sheets("CustList").Select

Cells([x], "D").Copy
Sheets("FinalList").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(NextRow, 4).Select
ActiveSheet.Paste
Sheets("CustList").Select

Cells([x], "E").Copy
Sheets("FinalList").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(NextRow, 5).Select
ActiveSheet.Paste
Sheets("CustList").Select

Cells([x], "F").Copy
Sheets("FinalList").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(NextRow, 6).Select
ActiveSheet.Paste
Sheets("CustList").Select

Cells([x], "G").Copy
Sheets("FinalList").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(NextRow, 7).Select
ActiveSheet.Paste
Sheets("CustList").Select

Cells([x], "CA").Copy
Sheets("FinalList").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(NextRow, 8).Select
ActiveSheet.Paste
Sheets("CustList").Select

End If
Next x
End Sub
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Try

Code:
Cells([x], "CA").Copy
Sheets("FinalList").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(NextRow, 8).PasteSpecial Paste:=xlPasteValues
 
Upvote 0
Hi,

Instead of "ActiveSheet.Paste"

Try the below one

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Regards,
SK
 
Upvote 0
Many thanks for this, it works perfectly. If you only knew how long I'd been playing with this.
Much appreciated,
Nick
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top