Hello hassankhan,
The attached workbook uses a VBA UserForm to validate and input the data into column "A" starting at cell "A2". Here is the UserForm code.
To run the macro press the keys Ctrl+e
Dim RepeatCount As Integer
Private Sub CommandButton1_Click()
'DONE
Dim I As Long
Dim LastEntry As Range
Dim Rng As Range
Dim RngEnd As Range
Set Rng = ActiveSheet.Range("A2")
Set RngEnd = Cells(Rows.Count, Rng.Column).End(xlUp)
Set LastEntry = IIf(RngEnd.Row <= Rng.Row, Rng, RngEnd.Offset(1, 0))
For I = 1 To RepeatCount
LastEntry = TextBox1
Set LastEntry = LastEntry.Offset(1, 0)
Next I
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1)
TextBox1.SetFocus
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox2 = "" Then Exit Sub
On Error Resume Next
RepeatCount = CInt(TextBox2.Value)
If Err <> 0 Or RepeatCount < 0 Then
Cancel = True
MsgBox "You must enter a number greater than zero."
TextBox2.SelStart = 0
TextBox2.SelLength = Len(TextBox2)
TextBox2.SetFocus
End If
End Sub
Bookmarks