LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Exchanging Values Between Two ListBoxes.

Hello,

I have two listboxes on a form, one which holds a master list and the
other the selections I have made. Basically, as I click on values from
the master list I want it to disappear from the master and appear in
the selected list (and vice versa). Initially, the master will be
fully populated, but eventually some of the selections will be moved
over to the selected list. Currently I do this by reading from a
global list in a hidden sheet and, depending on which listbox the
entry should be in, populate the correct listbox. These values are
written to a named sheet range each time (as this helps greatly with
sorting) by capturing the _Click event on both of the listboxes.

My first problem is this; on the first click the _Click routine
effectively fires twice and therefore the entry underneath the one
selected moves across to the other listbox as well as the one
selected. This only happens the first time I click on the listbox as
all subsequent clicks only move the line selected. I've tried to
capture the first time it initialises the _Click by setting a status
flag to False when the form loads and using an IF statement in the
_Click routine to prevent it running the first time, but this means
that all subsequent clicks need to be performed twice to get it to
run. Any help would be much appreciated on this one as both
workarounds don't produce satisfactory results. I can post code if you
think it'll help.

My second problem also involves these listboxes, but is more of an
annoyance. Assuming that the above problem was solved, I'd like to be
able to select an entry on ListBoxA, watch it jump over to ListBoxB
and be able to select the entry below on ListBoxA to do the same.
However, when I click to move an item the item below is automatically
highlighted (in blue) and is unselectable, which means I have to click
a different item, then the one I want and finally unselect the other
one from the other list which might remove two entries if I can't
solve the problem above! If anyone knows how to unhighlight on the
_Click event, I'd appreciate it. I have tried the
UserForm.ListBox1.Selected(i) = True/False, but that didn't seem to do
anything. Is there a way of refreshing ListBoxes without having to
reinitialise the form each time?

Cheers,

Ross.

 
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
Exchanging information BBS0 Excel Worksheet Functions 2 December 2nd 08 03:38 AM
exchanging rows nada Excel Worksheet Functions 1 February 27th 08 01:53 PM
Exchanging text between two cells cherij Excel Programming 4 March 23rd 06 07:00 PM
exchanging values amoung sheets havey Excel Worksheet Functions 4 February 25th 06 04:05 AM
exchanging X and Y in a plot Bruce Bowler Excel Programming 3 August 5th 05 02:33 PM


All times are GMT +1. The time now is 05:15 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"