Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox with use like inputbox
Hello and thank you in advance for your help, The issue that I am having is that I need a listbox to come up in th place of an inputbox. I am new to VBA, and cannot seem to figure thi out. The exact issue is that I have a form that is filled out with mainl string entrys, however there are a few fields that are forced from list. I am working on a secondary form to edit that information however I would like to still force one of the pre-established choices and need a listbox to pop up rather than an inputbox for those specifi entries. I am not very good at explaining my issues, so if you need mor information, please let me know. Thank you, Joh -- kralj ----------------------------------------------------------------------- kraljb's Profile: http://www.excelforum.com/member.php...nfo&userid=995 View this thread: http://www.excelforum.com/showthread.php?threadid=31991 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox with use like inputbox
kraljb wrote in message ...
Hello and thank you in advance for your help, The issue that I am having is that I need a listbox to come up in the place of an inputbox. I am new to VBA, and cannot seem to figure this out. The exact issue is that I have a form that is filled out with mainly string entrys, however there are a few fields that are forced from a list. I am working on a secondary form to edit that information, however I would like to still force one of the pre-established choices, and need a listbox to pop up rather than an inputbox for those specific entries. I am not very good at explaining my issues, so if you need more information, please let me know. Thank you, Hi ! John Try This ; First Open the VBA editor add a userForm and create a listbox, then in your VBA project "This WorkBook" add your code, (this code shows the months in a comb box) This code must be placed in "thisWorkbook" Private Sub Workbook_Open() UserForm1.ComboBox1.AddItem "Janeiro" UserForm1.ComboBox1.AddItem "Fevereiro" UserForm1.ComboBox1.AddItem "Marco" UserForm1.ComboBox1.AddItem "Abril" UserForm1.ComboBox1.AddItem "Maio" UserForm1.ComboBox1.AddItem "Junho" UserForm1.ComboBox1.AddItem "Julho" UserForm1.ComboBox1.AddItem "Agosto" UserForm1.ComboBox1.AddItem "Setembro" UserForm1.ComboBox1.AddItem "Outubro" UserForm1.ComboBox1.AddItem "Novembro" UserForm1.ComboBox1.AddItem "Dezembro" UserForm1.Show End Sub This code must be placed in UserForm Private Sub CommandButton1_Click() If UserForm1.ComboBox1 = "Janeiro" Then Worksheets("Dados").Cells(5, 4) = Val(UserForm1.TextBox1) UserForm1.TextBox1 = "" End If if UserForm1.ComboBox1 = "Fevereiro" Then Worksheets("Dados").Cells(5, 5) = UserForm1.TextBox1 UserForm1.TextBox1 = "" End If End Sub Hope this helps Best regards Joaquim Fernandes |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
listbox B conditional of input in Listbox A | Excel Discussion (Misc queries) | |||
Inputbox with Listbox | Excel Discussion (Misc queries) | |||
Inputbox and Application.InputBox | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming |