Hi

I have the below code in my userform under a command button named ‘yes’. When I enter data into my userform & click the yes button this error appears – Compile error: Sub or Function not defined

Does anyone know what I’m missing here?

Private Sub Yes_Click()

Dim emptyRow As Long

'Make Sheet1 active
sheet1.Activate

'Determine emptyRow
Set emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1

'Transfer information
Cells(emptyRow, 1).Value = NameTextBox.Value
Cells(emptyRow, 2).Value = SurnameTextBox.Value
Cells(emptyRow, 3).Value = AgeTextBox.Value
Cells(emptyRow, 4).Value = NextPaymentTextBox.Value
Cells(emptyRow, 5).Value = FrequencyComboBox.Value

End Sub
Thanks