I'm trying to get excel to copy the B,C,D and E column of the same row and paste onto cells L2, M2, N2 and O2 when a cell in B is selected. Currently I'm using this:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 2 Then
Target.Offset(0, 0).Copy Destination:=Range("L2")
Target.Offset(0, 1).Copy Destination:=Range("M2")
Target.Offset(0, 2).Copy Destination:=Range("N2")
Target.Offset(0, 3).Copy Destination:=Range("O2")
End If
End Sub
However, I can't run this as a macro and I have to copy and paste this onto the sheet in vba. Is there a way I could rewrite this so it is part of a macro? Would really appreciate help. Thanks.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 2 Then
Target.Offset(0, 0).Copy Destination:=Range("L2")
Target.Offset(0, 1).Copy Destination:=Range("M2")
Target.Offset(0, 2).Copy Destination:=Range("N2")
Target.Offset(0, 3).Copy Destination:=Range("O2")
End If
End Sub
However, I can't run this as a macro and I have to copy and paste this onto the sheet in vba. Is there a way I could rewrite this so it is part of a macro? Would really appreciate help. Thanks.