篩選跳另一SHEET 多重判斷

http://www.FunP.Net/973236

1 個解答

• 1 0 年前
最佳解答

請參考以下巨集

Sub 按鈕2_Click()

Sheets("結'果").Cells.ClearContents

Sheets("業務1").Rows(1).Copy

Sheets("結'果").Select

Sheets("結'果").Rows(1).Select

ActiveSheet.Paste

Application.CutCopyMode = False

r1 = Sheets("業務1").[A65536].End(xlUp).Row

r2 = Sheets("結'果").[A65536].End(xlUp).Row

For i = 2 To r1

If Sheets("業務1").Cells(i, 9) = Date Then

Sheets("業務1").Rows(i).Copy

r2 = r2 + 1

Sheets("結'果").Rows(r2).Select

ActiveSheet.Paste

Application.CutCopyMode = False

End If

Next i

For i = 2 To r1

If Sheets("業務1").Cells(i, 11) = Date Then

Sheets("業務1").Rows(i).Copy

r2 = r2 + 1

Sheets("結'果").Rows(r2).Select

ActiveSheet.Paste

Application.CutCopyMode = False

End If

Next i

r2 = r2 + 1

For i = 2 To r1

If Sheets("業務1").Cells(i, 1) = Date Then

Sheets("業務1").Rows(i).Copy

r2 = r2 + 1

Sheets("結'果").Rows(r2).Select

ActiveSheet.Paste

Application.CutCopyMode = False

End If

Next i

r2 = r2 + 1

For i = 2 To r1

If Sheets("業務1").Cells(i, 8) = Date Or Sheets("業務1").Cells(i, 10) = Date Or Sheets("業務1").Cells(i, 12) = Date Then

Sheets("業務1").Rows(i).Copy

r2 = r2 + 1

Sheets("結'果").Rows(r2).Select

ActiveSheet.Paste

Application.CutCopyMode = False

End If

[A1].Select

Next i

End Sub

• 登入以對解答發表意見