Past the Value from a ListBox into next available Cell

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
1,805
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
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Ams_A

New Member
Joined
May 8, 2013
Messages
14
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,372
Messages
5,595,787
Members
414,021
Latest member
whyjaydee

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