freshwattrout
New Member
- Joined
- Jul 17, 2021
- Messages
- 3
- Office Version
- 2016
- Platform
- Windows
I need help to make a VBA macro that looks up column B in the source sheet, determines if the value is "Y", and cuts and pastes rows C:F to the destination worksheet. I currently have the following code:
Source sheet (KITTING PRIORITY)
Destination worksheet (Completed)
VBA Code:
Option Explicit
Sub Completed()
Windows("Kitting.xlsx").Activate
Dim LastRow As Long, i As Long
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 2 To LastRow
If Range("B" & i).Value = "Y" Then
Dim pn As String
pn = Range("C" & i).Value
Sheets("Completed").Select
Sheets("Completed").Range("C" & i).Value = pn
End If
Windows("Production Schedule 2021.xlsm").Activate
Next i
End Sub
Source sheet (KITTING PRIORITY)
Destination worksheet (Completed)