I am trying to alter my move under
macro to move columns under columns on a different sheet.
It worked fine when I was moving columns under other columns on the same sheet.
I can not get the proper syntact for the wsS.Range(Cells(2, j), Cells(lRow, j)).Copy _
Destination:=wsT.Range(Cells(LR, k), Cells(LR, k)).Offset(1, 0)
When I run the macro nothing happens no errors are thrown and nothing is moved
Thanks
Sub MoveUnder()
Dim wsS As Excel.Worksheet
Dim wsT As Worksheet
Dim ar As Variant
Dim er As Variant
Dim i As Variant
Dim h As Variant
Dim j As Long
Dim k As Long
Dim lRow As Long
Dim LR As Long
Set wsS = ActiveWorkbook.Sheets(1)
Set wsT = ActiveWorkbook.Sheets(2)
ar = Array("user id", "user name") ' Find column to copy
er = Array("user id", "user name") ' Find column to paste beneith
lRow = wsS.Range("A" & Rows.count).End(xlUp).Row
LR = wsT.Range("A" & Rows.count).End(xlUp).Row
On Error Resume Next
For i = LBound(ar) To UBound(ar)
j = wsS.Rows(1).Find(ar(i), Rows(1).Cells(Rows(1).Cells.count), , xlWhole, xlByRows).Column
k = wsT.Rows(1).Find(er(i), Rows(1).Cells(Rows(1).Cells.count), , xlWhole, xlByRows).Column
wsS.Range(Cells(2, j), Cells(lRow, j)).Copy _
Destination:=wsT.Range(Cells(LR, k), Cells(LR, k)).Offset(1, 0)
Next i
On Error GoTo 0
End Sub