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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,528
Messages
5,837,880
Members
430,520
Latest member
VenkateshRajaganesan

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