Hi All:

I'm having a little issue troubleshooting the code below.

This is the Userform:

Userform.png

The desired output is that a new row is added to the active sheet. The "Text" input will appear in the B Column position of the new row. The "Code" input will appear in the A Column of the new row.

The actual output is that a new row is added to the active sheet (Good). The "Text" input appears in the B Column position of the new row (Good). The "Code" input always inputs the number "14" (no matter what the actual input is in this box-not Good). I get a run-time error '1004': AutoFill method of Range class failed.

So, could someone take a look at the below and give some suggestions?

Private Sub CommandButton1_Click()
'MsgBox UserForm1.TextBox1.Value
UserForm1.TextBox1.Value = Worksheets.Count

Dim lab1 As String
Dim lab2 As String
lab1 = UserForm1.TextBox1.Value
lab2 = UserForm1.TextBox2.Value
If lab1 = "" Or lab2 = "" Then
MsgBox "Fill in both boxes!"

Else
Dim ws As Worksheet

Set ws = ActiveSheet

For Each Cell In ws.Range("A10:A100")
If Len(Cell) = 0 Then Cell.Select: Exit For
Next Cell
ActiveCell.EntireRow.Insert
myRow = ActiveCell.Row
myOldRow = myRow - 1
Cells(myRow, "A") = lab1
Cells(myRow, "B") = lab2
Set SourceRange = ws.Range("F" & myOldRow & ":Y" & myOldRow & "")
Set fillRange = ws.Range("F" & myRow & ":Y" & myRow & "")
SourceRange.AutoFill Destination:=fillRange
Dim lastColumn As Long


'lastColexumn = ActiveSheet.Range("A1").SpecialCells(xlCellTypeLastCell).Column
'Columns(lastColumn).Copy Destination:=Columns(lastColumn + 1)

UserForm1.Hide
End If