阿猴 asked in 電腦與網際網路軟體 · 1 decade ago

篩選跳另一SHEET 多重判斷

我想請問各位大大的是 該怎麼從"業務1"篩選到"結果"

用講的比較不好講

請各位大大看我附的檔吧!!

http://www.FunP.Net/973236

1 Answer

Rating
  • 1 decade ago
    Best Answer

    圖片參考:http://l.yimg.com/f/i/tw/ugc/rte/smiley_4.gif

    請參考以下巨集

    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

Still have questions? Get your answers by asking now.