Forum Discussion

ChicagoLane's avatar
ChicagoLane
Copper Contributor
Jan 11, 2024

VBA Needed - Move Row From Table to Different Table based on Cell Value

Hello...  I have a table with a column B called "Owned By".  I will create a Data Validation List with 8 names to select from in that column.  I would like my team of 8 people to be able to select t...
  • ChicagoLane's avatar
    Jan 19, 2024

    I just received this code from another forum that worked perfectly:

    Sub MoveCRLIJ()
         Dim V, R&, W
       With Sheet2.ListObjects(1)
            V = Filter(.Parent.Evaluate(Replace("TRANSPOSE(IF(#>0,ROW(#)-" & .Range.Row & "))", "#", .DataBodyRange.Columns(2).Address)), False, False)
        For R = 0 To UBound(V)
         If Evaluate("ISREF('" & .ListRows(V(R)).Range(2) & "'!A1)") Then
            W = .ListRows(V(R)).Range
       With Sheets(.ListRows(V(R)).Range(2).Text).Cells(Rows.Count, 1).End(xlUp)
           .Cells(2 + (.Text = "")).Resize(, UBound(W, 2)) = W
       End With
         Else
            V(R) = False
         End If
        Next
            V = Filter(V, False, False)
            For R = UBound(V) To 0 Step -1:  .ListRows(V(R)).Delete:  Next
       End With
    End Sub

Resources