userform

A

Aashi

ok i have a userform.in the properties-controlsource
filed i hav put where i want the data to go on the
spreadsheet. e.g A2

but i dont always want it to go there. i want it to stay
in that column but go to the next blank cell.how?
 
K

Kevin

Sounds like you will need to determine the last row. Try this

Sub WriteLastRow(
Dim LastRow As Intege
With Worksheets("Sheet1"
LastRow = .Cells.Find("*", [A1], , , xlByRows, xlPrevious).Ro
.Cells(LastRow + 1, 1) = Me.Textbox1.Tex
End Wit
End Su

Kevin
 
T

Tom Ogilvy

You would need the click event and write the value to that cell. Remove the
controlsource property

Private Sub Combobox1_Click()
Dim rng as Range
Set rng = Cells(rows.count,"A").End(xlup)(2)
rng.Value = combobox1.Value
End Sub
 
Top