Kadang kita akan menginput data namun syaratnya bila nama atau data yang dimaksud sudah terimput maka sistem akan akan memberi pesan bahwa data tersebut sudah ada
Private
Sub CommandButton1_Click()
With
Sheets("Sheet1").Range("b6:b50")
Set c = .Find(TextBox1.Value,
LookIn:=xlValues)
If c Is Nothing Then
Dim irow As Long
irow =
Worksheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Offset(1, 1).Row
Worksheets("Sheet1").Cells(irow,
2).Value = TextBox1.Value
Worksheets("Sheet1").Cells(irow,
3).Value = TextBox2.Value
Worksheets("Sheet1").Cells(irow,
4).Value = TextBox3.Value
Worksheets("Sheet1").Cells(irow,
5).Value = TextBox4.Value
Else
MsgBox "Maaf
Nama Sudah Ada !", vbCritical
TextBox1.Value = ""
Exit Sub
End If
End With
End Sub
disable data duplicate
No comments:
Post a Comment