![]() |
List Box Populating problem
Im trying to get the listbox to populate from column H in a worksheet named
Expense. Here is the code i have already: Private Sub CommandButton1_Click() Set wks = Worksheets("Miles") lrA = wks.Cells(Rows.Count, 1).End(xlUp).Row lrB = wks.Cells(Rows.Count, 2).End(xlUp).Row wks.Range("A" & lrA + 1) = ListBox1.Text wks.Range("B" & lrA + 1) = TextBox1.Text TextBox1.Text = "" End Sub Private Sub CommandButton2_Click() Unload UserForm3 End Sub I cant figure out how to get it to populate without duplicates if soemone enters the same value twice. |
List Box Populating problem
Hi Ewing25,
See John Walkenbach's suggestion at: Filling a ListBox With Unique Items http://www.j-walk.com/ss/excel/tips/tip47.htm --- Regards. Norman "Ewing25" wrote in message ... Im trying to get the listbox to populate from column H in a worksheet named Expense. Here is the code i have already: Private Sub CommandButton1_Click() Set wks = Worksheets("Miles") lrA = wks.Cells(Rows.Count, 1).End(xlUp).Row lrB = wks.Cells(Rows.Count, 2).End(xlUp).Row wks.Range("A" & lrA + 1) = ListBox1.Text wks.Range("B" & lrA + 1) = TextBox1.Text TextBox1.Text = "" End Sub Private Sub CommandButton2_Click() Unload UserForm3 End Sub I cant figure out how to get it to populate without duplicates if soemone enters the same value twice. |
All times are GMT +1. The time now is 09:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com