I want a duplicate entry to column H to be prevented i have thousands of Rows and its hard to go throu each one please help cant figure it out
Private Sub CommandButton1_Click()
Dim cNum As Integer
Dim x As Integer
Dim nextrow As Range
Dim sht As String
'set the variable for the sheet
sht = ComboBox1.Value
'check for values
If Me.ComboBox1.Value = "" Then
MsgBox "Select a sheet from the combobox and add the date"
Exit Sub
End If
'change the number for the number of controls on the userform
cNum = 15
'add the data to the selected worksheet
Set nextrow = Sheets(sht).Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
For x = 1 To cNum
nextrow = Me.Controls("TextBox" & x).Value
Set nextrow = nextrow.Offset(0, 1)
Next
'clear the values in the userform
For x = 1 To cNum
Me.Controls("TextBox" & x).Value = ""
Next
'communicate the results
MsgBox "The values have been sent to the " & sht & " sheet"
Dim arrItems()
Dim cnt As Long
Dim pro As Long
For pro = 0 To TextBox3.ListCount - 1
If TextBox3.Selected(pro) Then
ReDim Preserve arrItems(cnt)
arrItems(cnt) = TextBox3.List(pro)
cnt = cnt + 1
End If
Next pro
If cnt > 0 Then
Range("C" & Rows.Count).End(xlUp).Value = Join(arrItems, "|")
End If
End Sub
Private Sub CommandButton1_Click()
Dim cNum As Integer
Dim x As Integer
Dim nextrow As Range
Dim sht As String
'set the variable for the sheet
sht = ComboBox1.Value
'check for values
If Me.ComboBox1.Value = "" Then
MsgBox "Select a sheet from the combobox and add the date"
Exit Sub
End If
'change the number for the number of controls on the userform
cNum = 15
'add the data to the selected worksheet
Set nextrow = Sheets(sht).Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
For x = 1 To cNum
nextrow = Me.Controls("TextBox" & x).Value
Set nextrow = nextrow.Offset(0, 1)
Next
'clear the values in the userform
For x = 1 To cNum
Me.Controls("TextBox" & x).Value = ""
Next
'communicate the results
MsgBox "The values have been sent to the " & sht & " sheet"
Dim arrItems()
Dim cnt As Long
Dim pro As Long
For pro = 0 To TextBox3.ListCount - 1
If TextBox3.Selected(pro) Then
ReDim Preserve arrItems(cnt)
arrItems(cnt) = TextBox3.List(pro)
cnt = cnt + 1
End If
Next pro
If cnt > 0 Then
Range("C" & Rows.Count).End(xlUp).Value = Join(arrItems, "|")
End If
End Sub