1
我有以下代码:Excel的VBA“对象变量或带块变量未设置”
Sub CheckDates()
bAlarm = False
i = 1
Do Until ActiveSheet.Cells(row_header, i).Value = ""
If ActiveSheet.Cells(row_header, i).Value = searchText Then
col = i
Exit Do
End If
i = i + 1
Loop
i = 1
Do Until ActiveSheet.Cells(row_header, i).Value = ""
If ActiveSheet.Cells(row_header, i).Value = searchNameText Then
col_name = i
Exit Do
End If
i = i + 1
Loop
If col = 0 Then
MsgBox searchText & " basliklar arasinda bulunamadi"
Exit Sub
Else
N = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
For i = row_header + 1 To N
If isInDateRange(ActiveSheet.Cells(i, col).Value) Then
With UserForm1.ListBox1
.AddItem
.List(.ListCount - 1, 0) = ActiveSheet.Cells(i, col_name).Value
.List(.ListCount - 1, 1) = ActiveSheet.Cells(i, col).Value
End With
bAlarm = True
End If
Next i
End If
If bAlarm = True Then
UserForm1.Show
End If
我收到就行了Object variable or With block variable not set (Error 91)
误差Do Until ActiveSheet.Cells(row_header, i).Value = ""
。当我调试时,我可以看到hprlink.Range
确实有一个值。任何想法我做错了什么?