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
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