ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform (https://www.excelbanter.com/excel-programming/296212-userform.html)

Aashi

userform
 
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?

Kevin

userform
 
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

Tom Ogilvy

userform
 
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

--
Regards,
Tom Ogilvy

"Aashi" wrote in message
...
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?





All times are GMT +1. The time now is 02:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com