Copies and saved in a different column

Closed
emtee - Aug 18, 2015 at 02:51 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 18, 2015 at 12:14 PM
Hello,

can you guys help me with this.
I want to input a data in cell A1, then it automatically copied into cell B1.
then if I input again another data in cell A1, it will automatically copied to cell B2.
then repeating the process until I reach the last cell in column B.

please...

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Aug 18, 2015 at 12:14 PM
Hi Emtee,

You can use the code below by right-clicking on your sheets tab and selecting View Code. Then paste the code in the big white field that appears in a new window.

The following code will do as requested:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
If Range("B1") <> vbNullString And Range("B2") <> vbNullString And _
Range("B1").End(xlDown).Row = Rows.Count Then Exit Sub
If Range("B1").Value = vbNullString Then
    Range("B1").Value = Target.Value
Else
    Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Value = Target.Value
End If
End Sub


Best regards,
Trowa
0