List Box Understanding

Patrick

Board Regular
Joined
Mar 2, 2002
Messages
50
I have a user form, on the user form is a list box, the row source of this list box is Montreal!$A2:$M33. This captures all my single row entries on the sheet Montreal.
The list box has a list style 1-fmliststyleoption, which means I can select an individual line in the list box from my entries on the sheet Montreal.
Is it possible to now add a command button, which on click copies the selected row in the list box and pastes it to a new sheet, starting at A1 on the new sheet.
Any and all responses welcome. Really just want to know if this is possible
Thanks
Patrick
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
How's this?
Code:
Private Sub CommandButton1_Click()
    Sheets("TheOtherSheet").Range("A65536").End(xlUp).Offset(1, 0) = ListBox1.Text
End Sub
Hope that helps,

Smitty
 

Patrick

Board Regular
Joined
Mar 2, 2002
Messages
50
:p
Hi and thanks for the help
It gets more dangerous can you continue?




Code:
Private Sub CommandButton2_Click()
    Sheets("Team").Range("A11").End(xlUp).Offset(1, 0) = ListBox1.Text
End Sub

The above copies the selected row,actually copies the first cell that is selected in the list box. Anyway to have it copy the adjacent cell also that has been selected in the list box
This must also recognize that if there is an entry already in the range then
copy to the cell below.




Also my range is A11 the copy will start at A2 because of the offset
when I have filled my range I would like to have a dialogue box open
and say "Max players reached"
 

Watch MrExcel Video

Forum statistics

Threads
1,122,670
Messages
5,597,483
Members
414,146
Latest member
marginmakerb

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
Top