User-defined type not defined compilation error

Solved
yao.chris Posted messages 95 Status Member -  
yao.chris Posted messages 95 Status Member -
Hello everyone,

In the macro below, I get the error message "user-defined type not defined" appearing.
Can you please help me?
Thank you.

Private Sub CommandButton1_Click()
Dim derligne As Integer
If MsgBox("Do you confirm the addition of a new Client?", vbYesNo, "Confirmation") = vbYes Then
derligne = Sheets("Clients").Range("A456541").End(xlUp).Row + 1
Cells(derligne, 1) = TextBox1.Value
Cells(derligne, 2) = TextBox1.Value
Cells(derligne, 3) = TextBox1.Value
Cells(derligne, 4) = TextBox1.Value
Cells(derligne, 5) = TextBox1.Value
Cells(derligne, 6) = TextBox1.Value
Cells(derligne, 7) = TextBox1.Value
Cells(derligne, 8) = TextBox1.Value
Cells(derligne, 9) = TextBox1.Value
Cells(derligne, 10) = TextBox1.Value
End If
End Sub

3 answers

gbinforme Posted messages 14930 Registration date   Status Contributor Last intervention   4 744
 
Hello,

Dim derligne As Longger 

You should have found it by yourself!
Also, avoid using "integer" for the line, prefer "long" because if your sheet grows, you might run into an overflow issue.
--
Always stay zen
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupéry
0
yao.chris Posted messages 95 Status Member 2
 
Hello gbinforme,

Thank you very much for your feedback, it's true that me and English are not friends, lol, and let's not forget that I'm just starting!!!!
With this problem solved, another one has appeared, Grrrrrrrr.
It shows up in the "If MsBox"
"compilation error, Sub or Function not defined"
I don't see where the error is in my line.
Can you help me?
Thank you.
0
yao.chris Posted messages 95 Status Member 2
 
Ouch, sorry!!!
It was another typing error, a mistake in "MsBox"
With the "g" it’s better, so "MsgBox" works.

Thank you all and have a good Sunday.....
0