View Single Post
 
Old 11-04-2021, 11:04 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I think this works one row at a time.
Code:
Sub MoveARow()
  Dim aLRow As ListRow, activeListCells As Range
  Dim iRowSel As Integer, iRowList As Integer, iSelRow As Integer
  Dim aLO As ListObject, aLO2 As ListObject
  Set aLO = ActiveWorkbook.Sheets("ForEdit").ListObjects("tForEdit")
  Set aLO2 = ActiveWorkbook.Sheets("Edited").ListObjects("tEdited")
  iRowSel = Selection.Row
  iRowList = aLO.Range.Row
  
  Set activeListCells = Intersect(aLO.DataBodyRange, Selection)
  If activeListCells Is Nothing Then
    MsgBox "List row not selected"
  Else
    iSelRow = iRowSel - iRowList
    Set aLRow = aLO.ListRows(iSelRow)
  End If
  aLO2.ListRows.Add
  aLO2.ListRows(aLO2.ListRows.Count).Range.Value = aLRow.Range.Value
  aLRow.Delete
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote