user form - how to set up so it stores data when you press enter

I

Iain

Hi,

I have a problem with some code in VBA. I am trying to input 4 different
sets of data on "worksheet1" - "Code" "Number" "Weight " & "Cost per gram". I
have some code below which works for one set, and i am trying to modify this
to get all 4 lots of data input at the same time Is there anyway of being
asked for a code, then a number, then weight and finally Cost per gram" -
then being asked if you wish to enter more data, when "yes" goes through the
loop again,
and "no" goes back to Sheet1?

I have tried "calling "Private Sub TextBox2_KeyDown" from within the code
below and it isnt working.
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
lngRow = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row + 1
Sheets("Sheet1").Range("A" & lngRow) = TextBox1.Text
TextBox1.Text = ""
End If
End Sub

Many Thanks.

Iain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top