参数不是可选的,str =

时间:2018-10-11 07:08:19

标签: excel vba excel-vba

为什么要调试时,它会在

处出错
If Emp8.Value = True Then
    str = "Whatsapp, "
End If

它将出现;

  

参数不是可选的

基本上,我想编辑用户表单中的数据。

Private Sub cmdEdit_Click()

If Me.Emp1 = "" Then
Call MsgBox("The fields are not complete", vbInformation, "Edit Contact")
Exit Sub
End If

Set findvalue = Sheet1.Range("b8:b10000").Find(What:=Me.Emp1, LookIn:=xlValues)

findvalue.Offset(0, 1).Value = Me.Emp1.Value

If Emp8.Value = True Then
    str = "Whatsapp, "
End If

If Emp12.Value = True Then
    str = str & "SMS, "
End If

If Emp11.Value = True Then
    str = str & "Email, "
End If

If Emp10.Value = True Then
    str = str & "Facebook, "
End If

If Emp9.Value = True Then
    str = str & "Phone Call, "
End If
str = Left(str, Len(str) - 2)
    findvalue.Offset(0, 2) = str

If Emp2.Value = True Then
    findvalue.Offset(0, 3) = "Yes"
ElseIf Emp3.Value = True Then
    findvalue.Offset(0, 3) = "No"
End If

findvalue.Offset(0, 4).Value = Me.Emp4.Value
findvalue.Offset(0, 5).Value = Me.Emp5.Value
findvalue.Offset(0, 6).Value = Me.Emp6.Value
findvalue.Offset(0, 7).Value = Me.Emp7.Value

Call MsgBox("The contact has been updated", vbInformation, "Edit Contact")

On Error GoTo 0
Exit Sub

End Sub

0 个答案:

没有答案