View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
NDBC NDBC is offline
external usenet poster
 
Posts: 204
Default user form - how to set it up so it stores data when you press

Mike,

Thanks for that. It seems like it is exactly what I'm looking for. I tried
copying it in but get this error "Procedure declaration does not match
description of event or procedure having same name". The textbox is called
textbox1 so it is not the name. Is there something else I need.

Thanks


"Mike H" wrote:

You could do it like this which detects the enter key being pressed

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode < 13 Then Exit Sub
mysheet = "Sheet1"
lastrow = Sheets(mysheet).Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
Cells(lastrow, 1).Value = TextBox1.Text
End Sub

Mike

"NDBC" wrote:

Thanks for the replys but neither are quite what I wanted. I can do what both
examples do. That is put in the text box and have a button that does the
command to store the entered data.

What a want is a form with only the text box so that when you hit enter the
data is stored. I don't want to have to either click on the button or press
enter twice.

Can this be done.