返回列表 上一主題 發帖

[發問] 二個欄位資料搜尋?

謝謝!但好像不能執行,我是不是哪裡弄錯了.

TOP

本帖最後由 准提部林 於 2020-3-19 13:25 編輯

DEAR SIR
如下   

Sub AAA()
Sheet1.[J6:P65536].ClearContents
X = Sheet1.[A65536].End(xlUp).Row
Y = Sheet1.[J65536].End(xlUp).Row
For M = 2 To X
If Sheet1.Cells(M, 5) = Sheet1.Cells(2, 10) Or Sheet1.Cells(M, 5) = Sheet1.Cells(2, 11) Or Sheet1.Cells(M, 6) = Sheet1.Cells(2, 12) Or Sheet1.Cells(M, 6) = Sheet1.Cells(2, 13) Then
  Sheet1.Cells(Y + 1, 10).Resize(, 7).Value = Sheet1.Cells(M, 1).Resize(, 7).Value
    Y = Y + 1
  End If
  Next
End Sub
羅

TOP

        靜思自在 : 並非有錢魷是快樂,問心無愧心最安。
返回列表 上一主題