I’m relatively inexperienced in VBA code, but have a workbook that I am trying to organize based on “Status” of items listed in rows.
I have a drop down box in column “M” that allows the user to select “HOLD” or “RELEASED”… Based on this value, the line item needs to be copied and pasted into the same exact row in sheet 2 if the value = “RELEASED” (Example of line item range is (“B7:N7”)(Sheets are formatted exactly the same). I have code for this, but I need to remove the line item that is “RELEASED” from sheet 1 after it is copied and pasted into sheet 2.
Here is what I have… (Parts Staging Log = Sheet 1 … Released Parts Log = Sheet 2)
Public Sub CopyPasteRows()
Sheets("Parts Staging Log").Select
' Find the last row of data
FinalRow = Range("B828").End(xlUp).Row
' Loop through each row
For x = 7 To FinalRow
' Decide to copy based on column M value "RELEASED"
ThisValue = Range("M" & x).Value
If ThisValue = "RELEASED" Then
Range("B" & x & ":BM" & x).Copy
Sheets("Released Parts Log").Select
NextRow = Range("B828").End(xlUp).Row + 1
Range("B" & NextRow).Select
ActiveSheet.Paste
Sheets("Parts Staging Log").Select
End If
Next x
End Sub
If anyone can assist me with a deletion of the original line item that would be wonderful. Other comments are accepted as well!
Thanks!
My take on this: remove the loop (too slow) and replace with autofilter