作者:
kk04014 (阿助)
2016-03-07 14:28:06請問一下各位,我現在想把第一個工作表cells(i,3)的序號在第二個工作表
第四欄做查詢,如果第二個工作表第四欄的序號跟第一個工作表第三欄的序號相同,
則把第一個工作表cells(i,3)~cells(i,13)複製貼到第二個工作表對應的欄位中。
但卻出現需要物件的錯誤訊息,請大家幫忙看一下 謝謝
Sub cusip()
Dim i As Integer
Dim cn As Integer
Dim rng As Range
Sheets("sheet1").Select
For i = 2 To 842
Set aa = sheet2.Cells.Find(what:=sheet1.Cells(i, 3), LookIn:= _
xlValues, LookAt:=xlPart,
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext,
MatchCase:=False).Activate
Next
If aa = Cells(i, 3).Value Then
Let cn = rng.Find("aa").Column
Range(Cells(i, 3), Cells(i, 13)).Select
Selection.Copy
Sheets("sheet2").Select
Range(Cells(cn, 4), Cells(cn + 4, 4)).Select
Selection.Paste
Else
End If
End Sub