Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
Inputbox with Listbox Jeff Excel Discussion (Misc queries) 3 December 22nd 04 05:54 PM
Inputbox and Application.InputBox Maria[_7_] Excel Programming 1 September 20th 04 11:36 AM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM


All times are GMT +1. The time now is 06:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"