如何修复“运行时错误'424对象所需的错误”

时间:2019-01-04 09:44:54

标签: excel vba variables

因此,为了尽可能概括一下,我正在尝试创建一个文档,该文档使用用户表单(基于我团队的日常活动)一次计算一个或多个会计周。这里的问题是,一旦选择星期,我将收到运行时错误,并在显示用户表单后确认选择。 如果需要,我还可以提供excel文档。

Private Sub CommandButton2_Click()
coloana_has_been_done = "P"
test_verificare_1 = 0
test_verificare_2 = 0   
saptamana_selectata = GRPweek.ListBox1.Value   
If IsEmpty(saptamana_selectata) Or saptamana_selectata = "" Or GRPweek.ListBox1.ListIndex = -1 Then
    MsgBox "No GRP week has been selected !", vbCritical, "Error"
    Exit Sub
Else
    test_verificare_1 = 1
End If      
Dim db_page As Worksheet
Set db_page = Sheets("baza_date")

rand_data = data_cautata.Row

Set data_cautata = db_page.Columns("O:O").Find(What:=saptamana_selectata, LookIn:=xlFormulas, _
    LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False)
If Range(coloana_has_been_done & rand_data).Value = 1 Then
    MsgBox "The selected GRP week is already Completed", vbCritical, "Error"
    Exit Sub
Else
    test_verificare_2 = 1
End If
If test_verificare_1 = 1 And test_verificare_2 = 1 Then
    Call grp(rand_data)
    Unload Me
End If
End Sub

包含运行时“ 424”问题的行是:

rand_data = data_cautata.Row

0 个答案:

没有答案