This is a discussion on Put listbox value in correct worksheet cell within the Excel Questions forums, part of the Question Forums category; Hi all! Trying to make sure that a value chosen from a userform listbox gets placed in the proper worksheet ...
Trying to make sure that a value chosen from a userform listbox gets placed in the proper worksheet table cell (xl2007). After selecting one item from the list box and clicking enter, the value selected should get placed in the next designated cell.
I get Compile error: Argument not optional on Range. But offset is listed as a valid argument. Any ideas?Code:Private Sub btnEnter_Click() Dim NextRow As Long Sheets("Sheet1").Activate NextRow = Range.Offset _ (Range)("Table1[[#totals],[account]],-1,5")) Cells(NextRow, 5) = lstAccount.Text End Sub
Range should be to signify the "table range"?? I'm guessing!?!?!
The help files show to use this...
However, that would require a cell in the table to have already been selected.
Thanks for the quik response!
Aaaarrrggghhh!!! Something that simple and here I am complicating the CRAPOLA out of it!!Code:Dim NextRow As Long Sheets("Sheet1").Activate Range("Table1[[#Totals],[account]]").Select ActiveCell.Offset(rowoffset:=-1, columnoffset:=0).Activate ActiveCell = lstAccount.Text