none
[Excel] : change data value ---> shown in list box RRS feed

  • Question

  • hi 

    i have a form with a list box that show me my wanted value 

    now 

    i wanna to change the value that showing in list box at the same time (with Vba form)

    can i do it ?

    is it possible ?

     

    Wednesday, November 28, 2012 7:06 AM

All replies

  • You can't edit a value in a list box directly.

    If the RowSource of the list box is a range of cells, change the value of the relevant cell.

    If the list box has been populated using AddItem, you can use the List or Column property of the list box to change a value, e.g. to change the 3rd item:

    Me.ListBox1.List(2) = "new value"

    (Items start counting at 0, so List(2) is the 3rd item)

    Regards, Hans Vogelaar

    Wednesday, November 28, 2012 8:00 AM
  • Is there any way  that  I  do it 



    i wanna change the value shown in list box

    n o w .... in any way 
    Wednesday, November 28, 2012 9:00 AM
  • Why don't you use combo box, it allows you change value at run time.
    Wednesday, November 28, 2012 9:06 AM
  • because i have form with a list box that shown me base on search item  (data )  in a text box 

    i wanna to change data shown in  list box and apply to its row ....  

     
    Wednesday, November 28, 2012 9:12 AM
  • As I mentioned, you can't edit a list box entry directly. That's the way it is - list boxes are intended for viewing and selecting items, not for editing them.

    To be able to edit an item, use a text box or combo box (as suggested by RKHAN46211).


    Regards, Hans Vogelaar

    Wednesday, November 28, 2012 9:14 AM
  • can u help me  that  how i must be do it .. ? 

    Wednesday, November 28, 2012 9:16 AM
  • How do you populate the list box?

    Regards, Hans Vogelaar

    Wednesday, November 28, 2012 9:33 AM
  • Mr hans it is file that u help me to create it 

    http://sdrv.ms/ShW9LC

    i wanna to edit value of shown data in this list box 

    Wednesday, November 28, 2012 9:42 AM
  • If you want to edit a value in any column of the list box, you'd need to add a text box for each column.

    I won't have time to provide more detailed help during the next hours; I'm busy with other things. If nobody else replies, I'll look at it later.


    Regards, Hans Vogelaar

    Wednesday, November 28, 2012 11:20 AM
  • thanks Mr hans

    i was trying do it 

    but i couldn't 


    Wednesday, November 28, 2012 7:11 PM
  • What you want is quite complicated.

    I have added a column to the list box to store the row number; this column is hidden by setting its width to 0.

    I added text boxes to edit the individual columns. These text boxes are filled automatically when you select a row in the list box.

    Finally, I added a command button that updates the row in the list box using the values of the text boxes, and also the corresponding row in the worksheet.

    I have updated the wortkbook on SkyDriv http://sdrv.ms/ShW9LC


    Regards, Hans Vogelaar


    Wednesday, November 28, 2012 11:13 PM
  • I do not know how to thank Mr Hans 

    but this file have problems

    1- triple search only work in 2 condition ( data and Company )

    2- all changes in list box apply correctly  but these changes only apply in one row in report sheet 

    .........................................................


    Thursday, November 29, 2012 1:10 PM
  • Oops, sorry. In cmdUpdate_Click, the line

            r = Me.ListBox1.Column(c, 8)

    should have been

            r = Me.ListBox1.Column(8, i)

    The search should also work for info, but keep in mind that some of the cells contain a trailing space, for example "in pro " instead of "in pro".

    Regards, Hans Vogelaar

    Thursday, November 29, 2012 1:53 PM
  • thank you so much 

    Thursday, November 29, 2012 5:31 PM