
[英]macro Find same cell in two workbooks and copy other cell behind found cell
[英]Macro to find cell value in multiple sheets in the workbook and copy all what's in the left of that found cell to the master sheet
正如您在下面的代码中看到的那样,我可以让它查看 1 张纸并复制该单元格的剩余部分,偏移量为 2 个单元格(超过 2 个单元格我会收到错误,因为在某些情况下它是工作表的限制到左边)代码中缺少的是:
请帮助在此处输入图像描述
'Sub Plan_Rout()
Dim Fnd As Range, Cl As Range
With Sheets("sheet1")
For Each A1 In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
Set Fnd = Sheets("Sheet2").Range("A1:Z100").Find(A1.Value, , xlFormulas, xlWhole,
xlByRows, xlPrevious, False, , False)
If Not Fnd Is Nothing Then A1.Offset(, 1).Value = Fnd.Offset(, -1).Value
If Not Fnd Is Nothing Then A1.Offset(, 2).Value = Fnd.Offset(, -2).Value
Next A1
End With
End Sub'
谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.