Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Find value in cell then copy the cell above to next column I have a parts list i

ID: 639366 • Letter: F

Question

Find value in cell then copy the cell above to next column

I have a parts list in col A that contains cells with "<asp" and other text. I need to find these cells, then copy or cut-and-paste the cell above (part name) over one column and up one cell so it is inline with the part number.

   A       

MS28743

screw

<asp /cbsd

MS28432

screw, pan head

<asp /ces

    A                            B             

MS28743                screw

screw

<asp /cbsd

MS28432                screw, pan head

screw, pan head.

<asp /ces

Thanks once again for you help. You all are GREAT !!.

Explanation / Answer

Hi..

Alt+F11 > Insert Module > Past the below code > Click F5 to run.

Public Sub extractPart()
    For r = 1 To Range("A" & Rows.Count).End(xlUp).Row
        If Left(Range("A" & r).Value, 4) = "<asp" Then
            Range("A" & r).Offset(-2, 1).Value = Range("A" & r).Offset(-1, 0).Value
        End If
    Next r
End Sub.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote