Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default resetting a listbox after a macro

hi all

is it possible to refresh a listbox in a form after a macro has run?

the list box is poplated by options on a worksheets the user selects an
option then the listboxes options change. what i require is the selected line
to disappear again to allow the user to select a new optioin at the moment
the line selected stays blue after the macro has updated its values

thanks
rivers
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default resetting a listbox after a macro

Is the ListBox on a Sheet or a UserForm? Is it initially loaded by RowSource
or by List or by AddItem. If on a Sheet, is it from the Forms toolbar or
from the Control Toolbox. Also, if it has associated code, you should post
that as well.



"Rivers" wrote:

hi all

is it possible to refresh a listbox in a form after a macro has run?

the list box is poplated by options on a worksheets the user selects an
option then the listboxes options change. what i require is the selected line
to disappear again to allow the user to select a new optioin at the moment
the line selected stays blue after the macro has updated its values

thanks
rivers

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default resetting a listbox after a macro

its on form its a row setting linked to a sheet and the code is too big to post

"JLGWhiz" wrote:

Is the ListBox on a Sheet or a UserForm? Is it initially loaded by RowSource
or by List or by AddItem. If on a Sheet, is it from the Forms toolbar or
from the Control Toolbox. Also, if it has associated code, you should post
that as well.



"Rivers" wrote:

hi all

is it possible to refresh a listbox in a form after a macro has run?

the list box is poplated by options on a worksheets the user selects an
option then the listboxes options change. what i require is the selected line
to disappear again to allow the user to select a new optioin at the moment
the line selected stays blue after the macro has updated its values

thanks
rivers

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default resetting a listbox after a macro

Just a guess (without being able to see if your code is interfering in any
way)... try setting the ListIndex property to -1 (minus one)... doing that
should leave no item selected.

Rick


"Rivers" wrote in message
...
its on form its a row setting linked to a sheet and the code is too big to
post

"JLGWhiz" wrote:

Is the ListBox on a Sheet or a UserForm? Is it initially loaded by
RowSource
or by List or by AddItem. If on a Sheet, is it from the Forms toolbar or
from the Control Toolbox. Also, if it has associated code, you should
post
that as well.



"Rivers" wrote:

hi all

is it possible to refresh a listbox in a form after a macro has run?

the list box is poplated by options on a worksheets the user selects an
option then the listboxes options change. what i require is the
selected line
to disappear again to allow the user to select a new optioin at the
moment
the line selected stays blue after the macro has updated its values

thanks
rivers


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default resetting a listbox after a macro

In addition to Rick's suggestion, unloading the UserForm will also reset all
the controls on it. But of course that would take some code modification if
you are now hiding the form (which is what it sounds like) instead of
unloading it. But without knowing exactly how you are initializing the
UserForm and how it is being handled to cause the ListBox to retain the
selected value, I can't offer much more.

"Rivers" wrote:

its on form its a row setting linked to a sheet and the code is too big to post

"JLGWhiz" wrote:

Is the ListBox on a Sheet or a UserForm? Is it initially loaded by RowSource
or by List or by AddItem. If on a Sheet, is it from the Forms toolbar or
from the Control Toolbox. Also, if it has associated code, you should post
that as well.



"Rivers" wrote:

hi all

is it possible to refresh a listbox in a form after a macro has run?

the list box is poplated by options on a worksheets the user selects an
option then the listboxes options change. what i require is the selected line
to disappear again to allow the user to select a new optioin at the moment
the line selected stays blue after the macro has updated its values

thanks
rivers



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default resetting a listbox after a macro

sorry guys

i think we have our wires crossed a little

the list box has a row source linked to the spreadsheet. when the macros
done it clears the rows of data that the list box looks at thus turning the
list box blank.

however the option i selected before running the macro say line 3 of the
list box is still coloured blue its value is empty but still highlighted im
looking for a way to turn the list box from being highlighted after i have
run the macro

"JLGWhiz" wrote:

In addition to Rick's suggestion, unloading the UserForm will also reset all
the controls on it. But of course that would take some code modification if
you are now hiding the form (which is what it sounds like) instead of
unloading it. But without knowing exactly how you are initializing the
UserForm and how it is being handled to cause the ListBox to retain the
selected value, I can't offer much more.

"Rivers" wrote:

its on form its a row setting linked to a sheet and the code is too big to post

"JLGWhiz" wrote:

Is the ListBox on a Sheet or a UserForm? Is it initially loaded by RowSource
or by List or by AddItem. If on a Sheet, is it from the Forms toolbar or
from the Control Toolbox. Also, if it has associated code, you should post
that as well.



"Rivers" wrote:

hi all

is it possible to refresh a listbox in a form after a macro has run?

the list box is poplated by options on a worksheets the user selects an
option then the listboxes options change. what i require is the selected line
to disappear again to allow the user to select a new optioin at the moment
the line selected stays blue after the macro has updated its values

thanks
rivers

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default resetting a listbox after a macro

On Mon, 4 Aug 2008 11:59:01 -0700, Rivers
wrote:

sorry guys

i think we have our wires crossed a little

the list box has a row source linked to the spreadsheet. when the macros
done it clears the rows of data that the list box looks at thus turning the
list box blank.

however the option i selected before running the macro say line 3 of the
list box is still coloured blue its value is empty but still highlighted im
looking for a way to turn the list box from being highlighted after i have
run the macro


I never use rowsource.
http://www.dailydoseofexcel.com/arch...stboxcombobox/

However, I think you need to code

Me.ListBox1.Rowsource = ""

when you clear the range. And reset it to the range address when you
repopulate the range (or sometime just before you show the form).
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com
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
Resetting Buttons in Macro [email protected] New Users to Excel 0 October 18th 06 11:38 AM
ListBox (?) in a macro aca[_7_] Excel Programming 1 January 27th 06 12:46 PM
resetting custom buttons for macro mtarggart Excel Programming 3 March 28th 05 08:21 PM
problems resetting backcolor in listbox Kelley[_3_] Excel Programming 0 November 1st 04 10:23 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM


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