Excel codes [Closed]

Report
-
Posts
2670
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
October 22, 2020
-
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

1 reply

Posts
2670
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
October 22, 2020
446
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