Past the Value from a ListBox into next available Cell

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,341
Office Version
  1. 365
Platform
  1. Windows
This is what I tried. I know my error is in the ListBox.Value

Any help is appreciated

Private Sub CommandButton1_Click()
UnProtectit
Dim lastrow As Long
lastrow = Sheets("Submittal").Cells(Rows.Count, 1).End(xlUp).Row
ListBox2.Value Destination:=Sheets("Submittal").Range("C" & lastrow)
Application.CutCopyMode = False

Protectit

End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Not sure why you want to use Column 1 (i.e. A) for last row calculation and then update the listbox value in column C as that would be an issue in case your column C value keeps getting updated but Column A doesn't.

Hopefully this should help.

Lastrow = Cells(Rows.Count, "C").End(xlUp).Row
Cells(Lastrow + 1,"C") = ListBox2.Value

Last row is not the empty row and hence, lastrow +1 is being used.

Instead of column C you can use the number 3 or whichever column is applicable.
 
Upvote 0

Forum statistics

Threads
1,215,385
Messages
6,124,626
Members
449,174
Latest member
Anniewonder

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