hello all,
i am having some issues with cut an entire row out of my spreadsheet and moving it to a new location. below you will find a sample of the table and then followed by the code i am trying
A B c D
1 Checked First name last name friend signed up
2 Patrick Staten Nick Gross
3 Connor Olson Nick Gross
4 Mary West
5 Nick Gross
6 Mary Troll Sam Lux
the idea is if cell A2 is empty then look at D2 and take that name find it in column B and C then cut row 2 out and insert it below that persons name while also placing "yes" into the A column for that person. so when done it would look like this
A B c D
1 Checked First name last name friend signed up
4 yes Mary West
5 yes Nick Gross
2 yes Patrick Staten Nick Gross
3 yes Connor Olson Nick Gross
6 yes Mary Troll Sam Lux
i am having some issues with cut an entire row out of my spreadsheet and moving it to a new location. below you will find a sample of the table and then followed by the code i am trying
A B c D
1 Checked First name last name friend signed up
2 Patrick Staten Nick Gross
3 Connor Olson Nick Gross
4 Mary West
5 Nick Gross
6 Mary Troll Sam Lux
the idea is if cell A2 is empty then look at D2 and take that name find it in column B and C then cut row 2 out and insert it below that persons name while also placing "yes" into the A column for that person. so when done it would look like this
A B c D
1 Checked First name last name friend signed up
4 yes Mary West
5 yes Nick Gross
2 yes Patrick Staten Nick Gross
3 yes Connor Olson Nick Gross
6 yes Mary Troll Sam Lux
VBA Code:
Sub Prepare_Click()
Application.ScreenUpdating = False
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim Partner As String
Dim FirstPartner As String
Dim LastPartner As String
For i = 3 To 153
If IsEmpty(Cells(i, 2).Value) = True Then
If Cells(i, 5).Value <> " " Then
Partner = Cells(i, 5)
FirstPartner = Split(Partner, " ")(0)
LastPartner = Split(Partner, " ")(1)
For j = 3 To 153
If Cells(j, 3).Value = FirstPartner Then
If Cells(j, 4).Value = LastPartner Then
Cells(i, 2).Value = "yes"
Range(i).Cut Rows(j).Insert
End If
End If
Next j
End If
End If
Next i
end sub
Last edited by a moderator: