Forum Discussion

Suma_shankar's avatar
Suma_shankar
Copper Contributor
Jul 14, 2020

Need help with excel vba

xspJody I have two worksheets 1- copy 2- dest
Firstly, I have to delete 1 and 5 column and then copy data from 2nd column to 4 th column and paste in dest sheet next to available column (means next to last column used).
  • xspJody's avatar
    xspJody
    Copper Contributor

    Suma_shankar 

     

    If you're still looking for a solution you could try this

    Sub MySub()
        ActiveCell.Columns("A:E").EntireColumn.Select
        Selection.Copy
        Windows("Book2").Activate
        ActiveCell.Range("A1").Select
        Selection.End(xlToRight).Select
        ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
        Selection.Insert Shift:=xlToRight
    End Sub

Share