將工作表1、工作表2符合條件資料以find整合到工作表3問題
- 帖子
- 522
- 主題
- 36
- 精華
- 1
- 積分
- 603
- 點名
- 0
- 作業系統
- win xp sp3
- 軟體版本
- Office 2003
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2012-12-13
- 最後登錄
- 2021-7-11
|
試試看
Sub sech()
Dim i As Integer, j As Integer, Rng
Dim Nam As String
For i = 2 To 6
Nam = Sheets(3).Cells(i, "a")
Sheets(2).Select
Set Rng = Range("A:A").Find(What:=Nam, LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True, MatchByte:=False, SearchFormat _
:=False)
Sheets(3).Cells(i, "b") = Rng.Offset(, 1)
'無法切換問題
Sheets(1).Select
Set Rng = Range("B:B").Find(What:=Nam, LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True, MatchByte:=False, SearchFormat _
:=False)
Sheets(3).Cells(i, "c") = Rng.Offset(, -1)
Next i
End Sub |
|
|
|
|
|
|
|