Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your sheet "Enter Data" and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. The macro is triggered by a change in any cell in column G (Unique ID). This means that you have to enter the data in all the other columns first and enter the Unique ID last. If you go back and make a change in any row in "Enter Data", make the change first and then re-enter the Unique ID in column G.
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("G:G")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim orderNum As Range
On Error GoTo exitcode
If Target <> "" Then
Set orderNum = Sheets("AutoPopulate").Columns(7).Find(Target, LookIn:=xlValues, LookAt:=xlWhole)
If orderNum Is Nothing Then
Target.EntireRow.Copy Sheets("AutoPopulate").Cells(Rows.Count, "A").End(xlUp).**fset(1, 0)
Else
Target.EntireRow.Copy Sheets("AutoPopulate").Cells(orderNum.Row, 1)
End If
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
exitcode:
Application.EnableEvents = True
End Sub
Bookmarks