Hi everyone.. i am using the following code to enter data into a worksheet. I would like to make it so if the data being entered in textbox1 is already present in columnA of the worksheet then a message box will appear stating so, and none of the data from the form is entered onto the sheet.
Option Explicit
Private Sub CommandButton1_Click()
Dim LR As Long
With Sheets("Master")
LR = .Range("A" & .Rows.Count).End(xlUp).Row
If LR <> 1 Then LR = LR + 1
.Range("A" & LR).Value = Me.TextBox1
.Range("B" & LR).Value = Me.TextBox2
.Range("C" & LR).Value = Me.TextBox3
.Range("D" & LR).Value = Me.TextBox4
.Range("A" & LR).Offset(19, 0).Value = "ENTRY"
End With
Unload Me
End Sub
Bookmarks