简体   繁体   中英

Compile error. Argument not optional

I'm sure you will find the problem that I'm uncapable to do. Below you can see a resume of the code in which I have the problem. After changing the value in the combobox1 it shows an error "Compile error. Argument not optional", highlighting in yellow "Sub ComboBox1_Change()" and in blue "Call TextBox4_Exit". I think I'm doing something wrong with the arguments needed but don't know how to handle.

Thank you for your help.


Sub ComboBox1_Change()
If TextBox4.Visible = True And TextBox4.Value <> "" Then
    Call TextBox4_Exit
End If

Sub TextBox4_Exit(ByVal cancel As MSForms.ReturnBoolean)
    Dim placas As String
    placas = TextBox4.Value
    I = 3
While Range("E" & I).Value <> ""
    If Range("E" & I).Value = mensaje Then
        If Range("L" & I).Value = mensaje2 Then
            If sheet1 = "SIC" Then
                Range("X" & I).Value = placas
                TextBox11.Value = Range("Y" & I).Value
                TextBox10.Value = Range("Z" & I).Value
            Else
                Range("U" & I).Value = placas
                TextBox11.Value = Range("AN" & I).Value
            End If
        End If
    End If
I = I + 1
Wend
End Sub

First, the Sub TextBox4_Exit(ByVal cancel As MSForms.ReturnBoolean) has one argument and it's not marked as Optional,so you need to pass a parameter to Call TextBox4_Exit.

Second, did you miss your End Sub of ComboBox1_Change()?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM