Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transferring data between listboxes


Good afternoon,

I have a userform in which I have two listboxes. One is for options
that a user can select from and the other displays the user's
selections. Up to 12 options to choose from. What I want is to
transfer the options selected from the one listbox to the other as the
user selects them. I figured four buttions. Add Selecton, Add All,
Remove Selection, Remove All.

The problem is I am not sure how to get them from one listbox to the
other. And also, how to prevent duplications.

Once again, any help is appreciated!!!
Cheers,
dw


--
toocold
------------------------------------------------------------------------
toocold's Profile: http://www.excelforum.com/member.php...o&userid=31608
View this thread: http://www.excelforum.com/showthread...hreadid=528725

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Transferring data between listboxes

Here's kind of a simplified version of what I think you need, cause it sounds
like you know what you're doing other than this, and you could figure out the
rest easily.

Let me know how this works for you.

For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
ListBox2.AddItem ListBox1.List(i)
ListBox1.RemoveItem (i)
End If
Next i


"toocold" wrote:


Good afternoon,

I have a userform in which I have two listboxes. One is for options
that a user can select from and the other displays the user's
selections. Up to 12 options to choose from. What I want is to
transfer the options selected from the one listbox to the other as the
user selects them. I figured four buttions. Add Selecton, Add All,
Remove Selection, Remove All.

The problem is I am not sure how to get them from one listbox to the
other. And also, how to prevent duplications.

Once again, any help is appreciated!!!
Cheers,
dw


--
toocold
------------------------------------------------------------------------
toocold's Profile: http://www.excelforum.com/member.php...o&userid=31608
View this thread: http://www.excelforum.com/showthread...hreadid=528725


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transferring data between listboxes


Thanks Access101,

Everything works great except ListBox1.RemoveItem (i). For some
reason, whenever I include this line of code, I get an unspecified
error. I originally tried just coping your code and I got this error.
But if I comment it out, I don't get the error. But I also allow users
to enter the same option twice which is not ideal.

Any idea why this is happening?
Thanks again,
dw


--
toocold
------------------------------------------------------------------------
toocold's Profile: http://www.excelforum.com/member.php...o&userid=31608
View this thread: http://www.excelforum.com/showthread...hreadid=528725

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transferring data between listboxes


Still trying to figure this out and I was wondering if maybe my setu
for the listbox is causing me difficulties...

I have populated the listbox from a list in a worksheet. I used th
properties window, and set RowSource = the range for my list. M
question is could having the list populated this way be preventing m
from maniplating the listbox? Is there a better way?

cheers,
d

--
toocol
-----------------------------------------------------------------------
toocold's Profile: http://www.excelforum.com/member.php...fo&userid=3160
View this thread: http://www.excelforum.com/showthread.php?threadid=52872

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transferring data between listboxes


Figured it out. By populating the listbox using the UserForm_Initializ
procedure, the code worked perfectly.

Cheers,
d

--
toocol
-----------------------------------------------------------------------
toocold's Profile: http://www.excelforum.com/member.php...fo&userid=3160
View this thread: http://www.excelforum.com/showthread.php?threadid=52872



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
Synchronize data in two LISTBOXes cellist Excel Discussion (Misc queries) 1 October 12th 09 03:39 PM
Transferring Data Jessica Excel Discussion (Misc queries) 1 March 31st 09 04:20 PM
Transferring data tofimoon4[_2_] Excel Discussion (Misc queries) 17 February 24th 09 07:29 PM
Transferring items between multicolumn listboxes [email protected] Excel Discussion (Misc queries) 2 September 28th 07 03:09 PM
Transferring Data KandK Excel Discussion (Misc queries) 0 April 24th 06 10:25 AM


All times are GMT +1. The time now is 03:35 PM.

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

About Us

"It's about Microsoft Excel"