VBA Excel: copy data from listbox to a cell

Solved
Aude -  
f894009 Posted messages 17417 Registration date   Status Member Last intervention   -
Hello,

I'm looking for a code that would allow me, each time a data item is selected from the listbox, to automatically copy that data to a specific cell on the same sheet; is that possible?

Thank you!

1 answer

  1. f894009 Posted messages 17417 Registration date   Status Member Last intervention   1 717
     
    Hello,

    if listbox userform simple selection:

    Private Sub ListBox1_Change() Worksheets("feuil1").Range("D2") = ListBox1 End Sub
    2
    1. Aude
       
      Super, it works wonderfully, thank you very much!
      One small accessory question: is there a difference between ListBox1_Change and ListBox1_Click?
      Thanks again!!
      0
      1. f894009 Posted messages 17417 Registration date   Status Member Last intervention   1 717 > Aude
         
        Re,

        Simple selection listbox: click and change work with change before click
        Multi-selection listbox: only change works
        0