The last used range in my sheet's column E is row 12. I want the text in txtTime to get copied to the last empty row of column E and the the copied text to fill down to the number of rows mentioned in textbox txtRow.
Let's say for example the txtTime has the text "One" and the textbox txtRow has 5. I want the code to copy the text "One" 5 times to column E filling down to five rows from row 13.
I hope I've made my question clear. Any help would be kindly appreciated.
Code: Select all
Private Sub CommandButton1_Click()
Dim n As Long
Dim ws As Worksheet
Set ws = Worksheets("AP")
n = ws.Range("E" & Application.Rows.Count).End(xlUp).Row
ws.Range("E" & n + 1).Value = Me.txtOne.Value
Cells(Rows.Count, "E").End(xlUp).Resize(11).FillDown
End Sub