llenado dinamico con listbox

leicolei

New Member
Joined
Apr 3, 2002
Messages
11
Saludos.

Alguien sabe como puedo llenar un rango de celdas a partir de la seleccion uno a uno de un listbox

Gracias :pray:
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
ok en una hoja se tiene una base de datos, en la otra se tiene un textbox que al introducir una palabra con un CommandButton hace una busqueda en al base de datos y los resultados los pone en un listbox. mi pregunta es que si de los resultados del listbox, puedo elegir uno y pasarlo a una celda, esto se puede hacer poniendo la celda en el linkedcell pero como puedo hacerlo para que se vayan agregando abajo del ultimo que se selecciono como si fuera un carrito de compras.

de antemano gracias
 
Upvote 0
Bueno, algo así depronto ?

Este ejemplo tiene un ListBox1 y un CommandButton1, lleno los datos con números del 1 al 20, pero es no importa... lo que importa es el código del botón:

<font face=Courier New><SPAN style="color:#00007F">Option</SPAN> <SPAN style="color:#00007F">Explicit</SPAN>

<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> CommandButton1_Click()
    <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>
    <SPAN style="color:#00007F">For</SPAN> i = 0 <SPAN style="color:#00007F">To</SPAN> ListBox1.ListCount - 1
        <SPAN style="color:#00007F">If</SPAN> ListBox1.Selected(i) <SPAN style="color:#00007F">Then</SPAN>
            Range("A65536").End(xlUp).Offset(1).Value = ListBox1.List(i)
        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
    <SPAN style="color:#00007F">Next</SPAN> i
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>

<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> UserForm_Initialize()
    ListBox1.List = Evaluate("ROW(A1:A20)")
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
 
Upvote 0

Forum statistics

Threads
1,215,692
Messages
6,126,228
Members
449,303
Latest member
grantrob

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top