|
1学分
本帖最后由 zames 于 2022-10-11 14:23 编辑
单元格设置了密码保护工作簿之后会出现 VBA 代码运行错误,帮忙看下 VBA 代码怎么修改下,谢谢!
Private Sub CommandButton1_Click()
........
ActiveSheet.Unprotect
[A3].Resize(60000, 8).ClearContents
[i3].Resize(60000, 1).ClearContents
If num > 0 Then
[A3].Resize(num, 8) = jrr
[i3].Resize(num, 1) = krr
End If
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Dim x As Integer, mrr, h As Integer, Nrr(), z As Integer
h = Cells(Rows.Count, "I").End(xlUp).Row
If h = 1 Then Exit Sub
mrr = Range("I3:I" & h)
For x = 1 To UBound(mrr, 1)
z = z + 1
ReDim Preserve Nrr(1 To z)
Nrr(z) = Range("BE25").Value & mrr(x, 1)
Next x
Range("I3").Resize(z) = Application.Transpose(Nrr)
ActiveSheet.Protect
End Sub
|
最佳答案
查看完整内容
Private Sub CommandButton1_Click()
........
ActiveSheet.Unprotect
[A3].Resize(60000, 8).ClearContents
.Resize(60000, 1).ClearContents
If num > 0 Then
[A3].Resize(num, 8) = jrr
.Resize(num, 1) = krr
End If
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Dim x As Integer, mrr, h As Integer, Nrr(), z As ...
|