Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks Leith and JLGWhiz. I implemented JLGWhiz code and it codes perfectly.
I actually already had a button that i wanted the code to be part of so your code works like a charm. -- Learning "JLGWhiz" wrote: Add a command button to your UserForm and put this code in the form code module. When a value is added to the ComboBox, click the command button. Private Sub CommandButton1_Click() '??? Set srcRng = Sheets("Sheet2") _ .Range("A2", Cells(Rows.Count, 1).End(xlUp)) If WorksheetFunction. _ CountIf(srcRng, Me.Complaint_Verified.Value) = 0 Then Sheets("Sheet2").Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0) = Me.ComboBox1.Value End If End Sub "tracktraining" wrote: Hi Everyone, I have a combo box in a userform (Complaint.Verified). The box is populated with an initial list by the following code: With Workbooks("Service test by thi.xls").Worksheets("Sheet2") Set ComplaintRng = .Range("A2", .Cells(.Rows.Count, "A").End(xlUp)) End With 'using the entire range of values in the column A starting with A2 Me.Complaint_verified.List = ComplaintRng.Value If a new value was entered in the combo box (Me.complaint_verified) that is not part of the list, how do I add this new value to sheet2 under row A for future use. I have something like: For Each ComplaintRng.Value In ComplaintRng If Me.Complaint_verified < ComplaintRng.Value Then .Additem Me.Complaint_verified.Worksheets("sheet2").range(1 :4) End If Next ComplaintRng But of course this code doesn't work. Any suggestions. thanks! tracktraining -- Learning |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Updating Source List | Excel Discussion (Misc queries) | |||
Updating List | Excel Discussion (Misc queries) | |||
updating a list | Excel Programming | |||
list box updating itself | Excel Programming | |||
Updating a list | Excel Discussion (Misc queries) |