Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50112

Make data save in 1 row down from prev

$
0
0
hi i wondered if anybody could help with a code that saves data in the next row to the previous save data,

for example the user will fill in my form and then hit save which save the data in persific cells in row 19, and the they wish to save new data in the next row down. ive tryed all sorts of codes but non seem to be working so would anybody be able to help?

Here is the VBA Code i have for the form atm:

Code:

Private Sub cmdAdd_Click()
' Save form Contents Before Closing
Cells(19, 4).Value = txtDate.Text
Cells(19, 6).Value = txtPaid.Text
Cells(19, 12).Value = txtStaff.Text
Unload Me ' Close the form
End Sub

Private Sub cmdCancel_Click()
Unload Me ' Close the Form
End Sub

Private Sub txtDate_Enter()
txtDate.Text = Cells(19, 4).Value
End Sub

Private Sub txtPaid_Enter()
txtPaid.Text = Cells(19, 6).Value
End Sub

Private Sub txtStaff_Enter()
txtStaff.Text = Cells(19, 12).Value
End Sub

Private Sub Userform_Activate()
' Read initial values from Row 1:
txtDate.Text = Cells(19, 4).Value
txtStaff.Text = Cells(19, 12).Value
txtPaid.Text = Cells(19, 6).Value
End Sub


Any help would be great.

thanks
Chris

Viewing all articles
Browse latest Browse all 50112