This is a simple data entry form for a spredsheet wilth two columns Product & Price. VBA Code for dataentry into spredsheet through userform
Private Sub Enter_Click()
Dim nextrow As Long
Sheets("sheet1").Activate
nextrow = Application.WorksheetFunction.CountA(Range("A:A")) + 1
If txtproduct.Text = "" Then
MsgBox "Enter a Product name"
End If
Cells(nextrow, 1) = txtproduct.Text
If txtprice.Text = "" Then
MsgBox "Enter a Price"
End If
Cells(nextrow, 2) = txtprice.Text
End Sub
This automated concept is useful for dataentry when there are large no. of cloumns in a spreadsheet.
Private Sub Enter_Click()
Dim nextrow As Long
Sheets("sheet1").Activate
nextrow = Application.WorksheetFunction.CountA(Range("A:A")) + 1
If txtproduct.Text = "" Then
MsgBox "Enter a Product name"
End If
Cells(nextrow, 1) = txtproduct.Text
If txtprice.Text = "" Then
MsgBox "Enter a Price"
End If
Cells(nextrow, 2) = txtprice.Text
End Sub
This automated concept is useful for dataentry when there are large no. of cloumns in a spreadsheet.
No comments:
Post a Comment