Sub 提取月每日记录数据()
'
Application.ScreenUpdating = False
Dim name As String
name = Range("g3") & "月每日记录"
'
If MsgBox("确认要提取 " & Range("g3") & " 月份数据吗?", vbInformation Or vbOKCancel) = vbOK Then
Sheets("主表每日记录").Visible = True
Sheets("主表每日记录").Select
Range("A1:AM6681").Select
Selection.Copy
Sheets(name).Visible = True
Sheets(name).Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
Range("AM1:AM" & Range("AM6000").End(xlUp).Row).Select
Selection.AutoFilter Field:=1, Criteria1:="<>0" 'Operator:=xlAnd, Criteria2:="<>"这段代码可以隐藏空格
Dim i As Integer
For i = 0 To 50
If Range("b" & i * 131 + 3).Value = "" Then
Rows((i * 131 + 1) & ":" & (i + 1) * 131).Select
Selection.EntireRow.Hidden = True
End If
Next
Application.ScreenUpdating = True
End Sub
这段代码在运行时很正常,但是在打开后, 如果不按确定按取消或是按那个叉的时候总是提示调试,如何去掉调试呢,取消或按叉的时候正确运行。请VBA大侠帮忙找出错误所在,谢谢!!