ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form Question (https://www.excelbanter.com/excel-programming/288254-user-form-question.html)

Ray Batig

User Form Question
 
I am trying to do the following three things on a userform.
1. show a listbox that the user would be able to review a row of names
( no selection just visual update )
2. show a list of potential additional names ( user would be able to
click select the choice )
3. show a ' text input box' ( my descriptive name ) (this would allow
user to type in a name)

I think 1 & 2 are typical things I can program, however, I don't seem to
find any information on how to do 3. Might well be that all the looking I am
doing is for the wrong name?

Can someone tell me what to code or call this desire so I can code some
more? If there is nothing, anybody have an idea. It is very important that
the user should be able to review and see what names have been used.

Thanks in advance for your help.

Ray



Cliff Myers

User Form Question
 
If you are adding a list box then just add a textbox. But you say there
won't be any selection made for #1, then why not add a Label instead. That
will show all the names instead of the user scrolling for all the names. It
will be right beside your listbox icon on the tools menu bar.
For number 2 you can add either a combo or list box. Programmers choice,
don't see no difference except for the drop down and not the scroll.
In your userform initialiaze event just add:
Listbox1 or Combobox1.AddItem "Joe"
Listbox1 or Combobox1.AddItem "Frank"
etc.
If you are wanting the textbox to show what the user has chosen then just
add:
Textbox1.Value = Listbox1.Value & Listbox2.Value
Other than that the textbox will be blank for the user to type whatever they
want.
I hope I understood what you were asking. If not sorry for the
misdirection.
HTH
"Ray Batig" wrote in message
link.net...
I am trying to do the following three things on a userform.
1. show a listbox that the user would be able to review a row of names
( no selection just visual update )
2. show a list of potential additional names ( user would be able to
click select the choice )
3. show a ' text input box' ( my descriptive name ) (this would allow
user to type in a name)

I think 1 & 2 are typical things I can program, however, I don't seem to
find any information on how to do 3. Might well be that all the looking I

am
doing is for the wrong name?

Can someone tell me what to code or call this desire so I can code some
more? If there is nothing, anybody have an idea. It is very important

that
the user should be able to review and see what names have been used.

Thanks in advance for your help.

Ray





Tom Ogilvy

User Form Question
 
Assume names for Listbox1 are in row 2 starting in column A.
Private Sub Textbox1.Exit()
dim rng as Range, cell as Range
if len(trim(Textbox1.Text)) < 0 then
' get end of the row of names
set rng = cells(2,"IV").End(xltoLeft)(2)
rng.Value = Textbox1.Value
set rng = Cells(cells(2,1),rng)
Listbox1.Clear
for each cell in rng
listbox1.AddItem cell.Value
next
End if
End Sub

since your list of names is horizontal, you will need to use additem to get
them in your first listbox (item 1 below).

--
Regards,
Tom Ogilvy

Ray Batig wrote in message
link.net...
I am trying to do the following three things on a userform.
1. show a listbox that the user would be able to review a row of names
( no selection just visual update )
2. show a list of potential additional names ( user would be able to
click select the choice )
3. show a ' text input box' ( my descriptive name ) (this would allow
user to type in a name)

I think 1 & 2 are typical things I can program, however, I don't seem to
find any information on how to do 3. Might well be that all the looking I

am
doing is for the wrong name?

Can someone tell me what to code or call this desire so I can code some
more? If there is nothing, anybody have an idea. It is very important

that
the user should be able to review and see what names have been used.

Thanks in advance for your help.

Ray






All times are GMT +1. The time now is 05:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com