【发布时间】:2016-06-15 02:33:54
【问题描述】:
用户在 YesNo 消息框中有两个选项。如果否,它会执行一定的过滤器序列,但如果用户对消息框问题回答是,我想过滤另一列。目前,在“Else”处,我收到一条错误消息,内容为“编译错误:赋值左侧的函数调用必须返回 Variant 或 Object” ,但仅在用户选择否时过滤。
If MsgBox("Is This Item Catch Weight?", vbYesNo) = vbNo Then
retval = InputBox("Please Enter PO Cost")
ActiveSheet.Range("$A$1:$CL$293662").AutoFilter Field:=71, Criteria1:="=" & retval
retval = InputBox("Please Enter Net Weight")
ActiveSheet.Range("$A$1:$CL$293662").AutoFilter Field:=41, Criteria1:="=" & retval
Else: MsgBox("Is This Item Catch Weight?", vbYesNo) = vbYes
retval = InputBox("Please Enter PO Cost")
ActiveSheet.Range("$A$1:$CL$293662").AutoFilter Field:=71, Criteria1:="=" & retval
End If
End If
【问题讨论】: