forms - how to fill each line in a record

M

merlin777

sorry to ask such a basic question but I can't find the answer anywhere.

When you use FORM on the DATA menu to enter information, it automatically
moves to the next line when you hit 'NEW'

How does that work when you use the data entry tools on the FORMS toolbar? I
can populate a specific cell with data from text entry box, or a true or
false from a tick box or from a pull dowm. But I can't see how to apply that
data to columns in one row and then move to the next row.

for instance, heres a vastly simplified version of what I need to end up
with:

name/ start date/ probation completed/ probation passed or failed/
team
john 11/11/07 yes passed
blue
bill 12/1/06 no n/a
red
pete 3/4/07 yes failed
green

and I want a form that will populate this type of table using pull downs and
tick boxes rather than needing the text typed in full each time.

I'm missing something crucial I guess but I can't see what!

regards
jc
 
J

JLGWhiz

You have to write event code for the control to transfer the data from the
control to the cell on the worksheet.

expl:
Private Sub CommandButton1_Click()
Sheets(1).Range("A1") = Me.TextBox1.Text
End Sub

This code assumes a UserForm with a TextBox and a CommandButton. Data
entered into the TextBox will be copied to cell A1 of sheet 1 when the button
is clicked. To move it down a row each time you alter the code like:

Private Sub CommandButton1_Click()
If x < 1 Then x = 1
Sheets(1).Range("A" & x) = Me.TextBox1.Text
x = x + 1
End Sub

Each time you click the button, x will increment by 1 and advance the row
number for the next entry. This is a simplistic illustration. The actual
code would depend on individual requirements.
 
J

JLGWhiz

Code can also be written for a textbox from the forms toolbar on a worksheet
to accomplish the same results, but the process is different from using the
UserForm and my personal preference is to use controls from the Control
Toolbox rather than from the Forms Toolbar.
 

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