Sub Adder()
Dim rCell As Range
TEMPLATE_SHEET = "Form"
DATABASE_SHEET = "Database"
DATABASE_RECORDS = Sheets(DATABASE_SHEET).Range("A1:A10000")
'Find out if name or number are blank
For Each rCell In Sheets("Form").Range("B2:B4").Cells
If rCell.Value = "" Then
MsgBox "Please make sure all info is entered", vbInformation, "More info needed..."
Exit Sub
End If
Next rCell
'To find out if names or number exists
If WorksheetFunction.CountIf(Sheets("Database").Range("A:A"), Sheets("Form").Range("B2").Value) > 0 Then
If WorksheetFunction.CountIf(Sheets("Database").Range("B:B"), Sheets("Form").Range("B3").Value) > 0 Then
If WorksheetFunction.CountIf(Sheets("Database").Range("C:C"), Sheets("Form").Range("B4").Value) > 0 Then
MsgBox "This entry already exists", vbInformation, "Duplicate"
Range("B2:B6").ClearContents
Exit Sub
End If
End If
End If
Application.ScreenUpdating = False
COUNT_ROW = WorksheetFunction.CountA(Sheets("Database").Range("A:A"))+1
'To copy the data from the template to the database
'Data Field 1 to database
Sheets(TEMPLATE_SHEET).Select
Sheets(DATABASE_SHEET).Range("A" & COUNT_ROW).Value = Range("B2").Value
Sheets(DATABASE_SHEET).Range("B" & COUNT_ROW).Value = Range("B3").Value
Sheets(DATABASE_SHEET).Range("C" & COUNT_ROW).Value = Range("B4").Value
Sheets(DATABASE_SHEET).Range("D" & COUNT_ROW).Value = Range("B5").Value
Sheets(DATABASE_SHEET).Range("E" & COUNT_ROW).Value = Range("B6").Value
Range("B2:B6").ClearContents
Application.ScreenUpdating = True
End Sub
Hope this helps