简体   繁体   English

编译错误。 参数不可选

[英]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". 更改combobox1中的值后,它将显示错误“编译错误。参数不是可选的”,并以黄色突出显示“ Sub ComboBox1_Change()”和蓝色“调用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. 首先,Sub TextBox4_Exit(ByVal cancel As MSForms.ReturnBoolean)有一个参数,并且没有标记为Optional,因此您需要将参数传递给Call TextBox4_Exit。

Second, did you miss your End Sub of ComboBox1_Change()? 其次,您是否错过了ComboBox1_Change()的End Sub?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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