Thread: Duplicates
View Single Post
  #1   Report Post  
browie
 
Posts: n/a
Default Duplicates

Hi all,


I am looking for help with some code I have a combobox which I have linked
to column"a" on worksheet 150 which is called "dayoptions".

The problem I have is when someone exits this box it has the value go to 2
places 1 is the person's sheet
so I use the activesheet code

The problem I am having is if someone chooses a value which is already in
this list it copies the name and causes a duplicate in this record. How can
I stop this from happening?
here is the code again.

Private Sub CommandButton1_Click()
R = 46
ActiveSheet.Cells(R, 2).Value = UCase(ComboBox1.Text)
R = 46
ActiveSheet.Cells(R, 4).Value = UCase(TextBox1.Text)
R = 46
ActiveSheet.Cells(R, 3).Value = UCase(TextBox4.Text)
R = 46
ActiveSheet.Cells(R, 5).Value = UCase(TextBox6.Text)

R = 46
ActiveSheet.Cells(R, 6).Value = UCase(ComboBox2.Text)
R = 46
ActiveSheet.Cells(R, 8).Value = UCase(TextBox2.Text)
Sheet150.Range("A1").Insert
R = 46
ActiveSheet.Cells(R, 7).Value = UCase(TextBox3.Text)
R = 46
ActiveSheet.Cells(R, 9).Value = UCase(TextBox5.Text)


____________________________________________
R = 1
Sheet150.Cells(R, 1).Value = UCase(ComboBox1.Text)
Sheet150.Range("A1").Insert
R = 1
Sheet150.Cells(R, 1).Value = UCase(ComboBox2.Text)
___________________________________________


With Worksheets("dayoptions")
.Range("A1:A65536").Sort Key1:=.Range("A1")
End With

Unload Me
DAYOPTIONSDAYS.Show

End Sub

The code between the lines is where the problem is.

Thanks in advance
Greg