Hi.
I am doing a code where once the command button is press, in open up an input box and asked to input the name after which will be key in the first cell and if input a second name when pressed the command button, it will automatically fill in the next empty cell of the same column.
However, every time input a name, i would fill in 10 cells rather than just one cell. Here is my code.
Private Sub CommandButton1_Click()
Dim name As String
Dim i As Integer
name = InputBox("name?")
For i = 1 To 10
Cells(i, 1).Value = name
Next
End Sub
Hope i could get help from here as i am still new to VBA.
thank you!
I am doing a code where once the command button is press, in open up an input box and asked to input the name after which will be key in the first cell and if input a second name when pressed the command button, it will automatically fill in the next empty cell of the same column.
However, every time input a name, i would fill in 10 cells rather than just one cell. Here is my code.
Private Sub CommandButton1_Click()
Dim name As String
Dim i As Integer
name = InputBox("name?")
For i = 1 To 10
Cells(i, 1).Value = name
Next
End Sub
Hope i could get help from here as i am still new to VBA.
thank you!