list box updating itself
That code just looks like it would always delete the first row.
Range("A1").Select
would guarantee that
Range("A1") = selection
so you would never loop.
Just to demo from the immediate window:
Range("A1") = rnd()
Range("d4") = Selection
Range("A1").Select
? activeCell = selection
True
? activeCell.Value
0.705547511577606
It really doesn't matter what A1 contains, when you select it, then the
activecell will always equal the selection.
--
Regards,
Tom Ogilvy
wrote in message
oups.com...
what is a good way of removing a listbox selection from the list
i am using the following
private sub command button1 ()
dim selection
range("d4") = selection
range("a1").select
do until activecell.value = selection
activecell.offset(1,0).activate
loop
selection.entirerow.delete
end sub
as you can see i have set the control source of the listbox at d4
then i use that to find the row in the list and delete.
this works most of the time and the rows disapears off the list before
my eyes, however sometimes it stays there or freezes,
any hints or tips would be great, i am not sure if i should unload and
reload the form after i have deleted the row, so it resets the list.
i am really after abit of a better way of doing then i am at the moment
chris
|