|
求助:显示运行时错误“13”,类型不匹配。Sub 更新查询(BanBie As String)
Dim BBtemp As String
Dim DicBB1, DicBB2
Dim ArrBB1, ArrBB2, ArrJG1, ArrJG2
Dim Ct As Long, CtBB1 As Long, CtBB2
Dim Xu As Integer
Dim Duan As Integer
关闭可能导致拖慢速度的功能
Worksheets("按班别查询").Unprotect "L-Digital-K"
Duan = 40 '用户根据实际需要设置
Set DicBB1 = CreateObject("scripting.dictionary")
Set DicBB2 = CreateObject("scripting.dictionary")
With Worksheets("考生基本资料")
Ct = .Cells(Rows.Count, 3).End(xlUp).Row
If Ct = 1 Then
Worksheets("按班别查询").Unprotect "L-Digital-K"
开启可能导致拖慢速度的功能
Exit Sub
End If
ArrBB = .Cells(1, 1).Resize(Ct, 11)
For i = 2 To Ct
BBtemp = ArrBB(i, 3)
If BBtemp = BanBie Then
Xu = Xu + 1
If Xu <= Duan Then
DicBB1(i) = Array(Xu, .Cells(i, 4), .Cells(i, 5), .Cells(i, 6), .Cells(i, 9), .Cells(i, 10))
Else
DicBB2(i) = Array(Xu, .Cells(i, 4), .Cells(i, 5), .Cells(i, 6), .Cells(i, 9), .Cells(i, 10))
End If
End If
Next
End With
With Worksheets("按班别查询")
.Cells(6, 1).Resize(Duan, 13).ClearContents
.Range("A2") = Worksheets("设置").Range("B4") & "_" & Worksheets("设置").Range("B5") & " " & BanBie & " 班"
CtBB1 = DicBB1.Count
If CtBB1 > 0 Then
ArrJG1 = Application.Transpose(Application.Transpose(DicBB1.items))
.Cells(6, 1).Resize(CtBB1, 6) = ArrJG1
End If
CtBB2 = DicBB2.Count
If CtBB2 > 0 Then
ArrJG2 = Application.Transpose(Application.Transpose(DicBB2.items))
.Cells(6, 8).Resize(CtBB2, 6) = ArrJG2
End If
End With
Worksheets("按班别查询").Unprotect "L-Digital-K"
开启可能导致拖慢速度的功能
End Sub
|
|