UserForm and It is beyond me.Please help.

B

BEETAL

I am trying to do the following stuff.
1. Create a Combobox or Listbox whichever is appropriate to store integer
values, textsuch as names,other values if needed.
2. I want to link the items to another 'call, such as
If item chosen in the box is Obama,then paste " President of US of A" in a
cell. Other characteristics also can be pasted in adjacent cells by using few
more codes.

I got the folowing code from Excel Help which I miserably failed to run.
Sorry, I feel a little ashamed that after so many years this Form stuff is
yet to be understood.

Thanks in advance for all the help.
The code ----- How to run it. I just copied it from VBA help.
ListBox Control, Column, ColumnCount, List Properties Example

'

The following example loads a two-dimensional array with data and, in turn,
loads two ListBox controls using the Column and List properties. Note that
the Column property transposes the array elements during loading.

To use this example, copy this sample code to the Declarations portion of a
form. Make sure that the form contains two ListBox controls named ListBox1
and ListBox2.

Dim MyArray(6,3)

Private Sub UserForm_Initialize()
Dim i As Single
'The 1st list box contains 3 data columns
ListBox1.ColumnCount = 3
'The 2nd box contains 6 data columns
ListBox2.ColumnCount = 6

'Load integer values into first column of MyArray
For i = 0 To 5
MyArray(i, 0) = i
Next i

'Load columns 2 and three of MyArray
MyArray(0, 1) = "Zero"
MyArray(1, 1) = "One"
MyArray(2, 1) = "Two"
MyArray(3, 1) = "Three"
MyArray(4, 1) = "Four"
MyArray(5, 1) = "Five"

MyArray(0, 2) = "Zero"
MyArray(1, 2) = "Un ou Une"
MyArray(2, 2) = "Deux"
MyArray(3, 2) = "Trois"
MyArray(4, 2) = "Quatre"
MyArray(5, 2) = "Cinq"

'Load data into ListBox1 and ListBox2
ListBox1.List() = MyArray
ListBox2.Column() = MyArray

End Sub


Thank You
 
J

Jim Cone

Some very good help here on userforms (by Debra Dalgleish)...
http://www.contextures.com/xlUserForm01.html
--
Jim Cone
Portland, Oregon USA



"BEETAL"
<[email protected]>
wrote in message
I am trying to do the following stuff.
1. Create a Combobox or Listbox whichever is appropriate to store integer
values, textsuch as names,other values if needed.
2. I want to link the items to another 'call, such as
If item chosen in the box is Obama,then paste " President of US of A" in a
cell. Other characteristics also can be pasted in adjacent cells by using few
more codes.

I got the folowing code from Excel Help which I miserably failed to run.
Sorry, I feel a little ashamed that after so many years this Form stuff is
yet to be understood.

Thanks in advance for all the help.
The code ----- How to run it. I just copied it from VBA help.
ListBox Control, Column, ColumnCount, List Properties Example

-snip-

Thank You
 
B

BEETAL

Jim, Thanks for that website address. Great stuff. Clean and precise.
Now, can someone help me with the question which was,

HOW to connect items in the list or combo boxes. Such as , selection of one
item in BOx 1 leads to the selection of related items in other boxes. Please
give some time to this problem. '

AS usual, thank you in advance, a greatful me.
 
J

Jim Cone

Have you make a form with a ListBox and a Command Button and
filled the ListBox with your items?
Also, initially you wanted to paste info into a cell,
now you want to add info to another list box. Which is it?
--
Jim Cone
Portland, Oregon USA



"BEETAL" <[email protected]>
wrote in message
Jim, Thanks for that website address. Great stuff. Clean and precise.
Now, can someone help me with the question which was,

HOW to connect items in the list or combo boxes. Such as , selection of one
item in BOx 1 leads to the selection of related items in other boxes. Please
give some time to this problem. '

AS usual, thank you in advance, a greatful me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top