Sub 提取当月数据()
Dim name As String
name = Range("a3") & "月"
If MsgBox("确认要提取 " & Range("a3") & " 当前月份数据吗?", vbInformation Or vbOKCancel) = vbOK Then
Sheets("主表").Visible = True
Sheets("主表").Select
Range("A8:R1800").Select
Selection.Copy
Sheets(name).Visible = True
Sheets(name).Select
Range("A8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.ScreenUpdating = False
Dim i As Integer
For i = 8 To 1800
If Cells(i, 9) = "" And Cells(i, 11) = "" And Cells(i, 13) = "" And Cells(i, 15) = "" And Cells(i, 17) = 0 Then Rows(i).Hidden = True
Next i
Application.ScreenUpdating = True
End If
End Sub
这段代码中我感觉少了一个END IF可我添加上后,会显示错误提示,这样反而对。为什么呢,请高手帮忙说一下为什么,谢谢!!!