Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Clear value a listbox!

Can anyone know the way to set a ListBox(Form) empty.
With the TextBox and Combox the Text property can read and write.
But with the ListBox i think it only can read?
Is there any way?


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Clear value a listbox!

Is this something that you want ... ? This initialises a 2 column lis
box :-

'- initialise form
Private Sub UserForm_Initialize()
Set DataSheet = ThisWorkbook.Worksheets("data")
Set MyList = DataSheet.Range("FileList")
Rw = 1
FileListBox.Clear
While MyList.Cells(Rw, 1).Value < ""
FileListBox.AddItem
FileListBox.List(Rw - 1, 0) = MyList.Cells(Rw, 1).Value
FileListBox.List(Rw - 1, 1) = MyList.Cells(Rw, 2).Value
Rw = Rw + 1
Wend
End Su

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default How to Clear value a listbox!

Did you want to unselect any selected items, or did you want to remove
all the items showing in the listbox?

If the former, just use ListBox1.ListIndex = -1

If the latter, does your listbox have a rowsource, or is it populated
with AddItem?

--
HTH,
Dianne

Can anyone know the way to set a ListBox(Form) empty.
With the TextBox and Combox the Text property can read and write.
But with the ListBox i think it only can read?
Is there any way?


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Clear value a listbox!

What I mean is:
If I have a listbox1 which has a property List Range: A1:A3
A1="";
A2="1";
A3="2"; for example;
The list box I resize it into one row(Which will has up and dow
buttons). Assume I used down button to choose the value 2(A3).
How can I set listbox1 appear blank.
I can use:
ListBox1.ListIndex = 0;
But it only affect when the ListBox1 is selected!
Help me

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to Clear value a listbox!

Listbox.ListIndex = -1
Listbox.TopIndex = 0
would show what is in cell A1 (which is blank). I believe that is what you
mean.

--
Regards,
Tom Ogilvy

bookworm98 wrote in message
...
What I mean is:
If I have a listbox1 which has a property List Range: A1:A3
A1="";
A2="1";
A3="2"; for example;
The list box I resize it into one row(Which will has up and down
buttons). Assume I used down button to choose the value 2(A3).
How can I set listbox1 appear blank.
I can use:
ListBox1.ListIndex = 0;
But it only affect when the ListBox1 is selected!
Help me!


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Clear value a listbox!

Thanks Tom,
ListBox.TopIndex = 0
What all I need!
BEST WISHES,

Tom Ogilvy wrote:
*Listbox.ListIndex = -1
Listbox.TopIndex = 0
would show what is in cell A1 (which is blank). I believe that is
what you
mean.

--
Regards,
Tom Ogilvy

bookworm98 wrote in
message
...
What I mean is:
If I have a listbox1 which has a property List Range: A1:A3
A1="";
A2="1";
A3="2"; for example;
The list box I resize it into one row(Which will has up and down
buttons). Assume I used down button to choose the value 2(A3).
How can I set listbox1 appear blank.
I can use:
ListBox1.ListIndex = 0;
But it only affect when the ListBox1 is selected!
Help me!


---
Message posted from http://www.ExcelForum.com/
*



---
Message posted from http://www.ExcelForum.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
Transfer a name from one cell to another but leave clear if clear? Scoober Excel Worksheet Functions 3 May 22nd 09 02:55 AM
clear the clear the web page email attachment lines MCrider Excel Discussion (Misc queries) 0 November 11th 07 10:05 PM
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM


All times are GMT +1. The time now is 01:07 PM.

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"