Excel codes

Closed
Exceldummy - Apr 3, 2017 at 11:56 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Apr 3, 2017 at 12:03 PM
Hello,

I would like to be able to set up a spread sheet so when I type March on sheet1 in column A it copies the entire row onto sheet 2
Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Apr 3, 2017 at 12:03 PM
Hi Exceldummy,

You mean like this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("A")) Is Nothing Then Exit Sub
If Target.Value = "March" Then
    Target.EntireRow.Copy _
    Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
End Sub


To use the above, right-click sheet1's tab and select 'View code'. Paste the code in the big white field. Now make sure your destination sheet is called 'Sheet2' and type 'March' in column A of sheet1 and see what happens.

Best regards,
Trowa
0