Hi,
I cant seem to get it to work. here is the complete code for the userform:
Part Taken from an existing workbook
Private Sub cmdAdd1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Contacts")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for a Contact
If Trim(Me.txtPart.Value) = "" Then
Me.txtPart.SetFocus
MsgBox "Please enter a Contact"
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.TxtId.Value
ws.Cells(iRow, 2).Value = Me.txtPart.Value
ws.Cells(iRow, 3).Value = Me.txtLoc.Value
ws.Cells(iRow, 4).Value = Me.txtDate.Value
ws.Cells(iRow, 5).Value = Me.txtfax.Value
ws.Cells(iRow, 6).Value = Me.txtQty.Value
ws.Cells(iRow, 7).Value = Me.txtemail.Value
'clear the data
Me.TxtId.Value = ""
Me.txtPart.Value = ""
Me.txtLoc.Value = ""
Me.txtDate.Value = ""
Me.txtfax.Value = ""
Me.txtQty.Value = ""
Me.txtemail.Value = ""
Me.txtPart.SetFocus
End Sub
Private Sub cmdClose1_Click()
Unload Me
End Sub
Private Sub txtDate_Change()
End Sub
Where or what do i change to show the data required? on the contacts sheet,
A1 has a formula of: =COUNTA(A1:A1000)+1 which basically counts the amount of
contacts to date then adds 1 for the next contact. i need this to show in the
txtid box.
Regards,
Nigel