Why does copied data change??

iisailor

Board Regular
Joined
Feb 18, 2009
Messages
58
I have the following piece of code:

Sub StockCheck()

Dim PartSearch As Integer
Dim StockSearch As Integer
Dim Last As Long
Dim b As Long

'On Error GoTo Err_Execute
Workbooks("Parts TEST").Worksheets("1025 - Magnet Frames").Activate
PartSearch = 2
Last = ActiveSheet.UsedRange.Rows.Count
For b = 1 To Last
If Range("C" & CStr(PartSearch)).Value > 0 And Range("F" & CStr(PartSearch)).Value > 0 Then

Rows(CStr(PartSearch) & ":" & CStr(PartSearch)).Select
Selection.Copy

ActiveSheet.Paste Destination:=Workbooks("Stocking TEST").Worksheets("Stock Items").Cells(1260, 1)
Application.CutCopyMode = False

Else: PartSearch = PartSearch + 1
End If
PartSearch = PartSearch + 1
Next b

End Sub

Im in the early stages of this macro so for now im only having the macro copy a row of data to the next worksheet. The problem however is that although the code copies the correct row to the correct location, for some reason it changes the value of the cell in column F to 0. Can anyone explain why this is happening??
Thanks in advance
Chris
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Watch MrExcel Video

Forum statistics

Threads
1,129,814
Messages
5,638,492
Members
417,028
Latest member
JFCLUK

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
Top