I have 2 sheets in 2 different work book. a) Workbook(A).Sheets("A") b)Workbook(B).Sheets("B")
Sheet A in workbook A is destination file. Sheet B in Workbook B is source file.
用户名B(开张B)在表A中,然后从表B中找到高于参考值的数值。 如果发现价值,将立即复制并贴在A(工作手册b)上。 然后回到表B,以找到随后的价值(大于参考价值)。 这一进程一直持续到符合某些标准。
I manage to find the value in loop, but i have to paste the value into sheet B, then copy to sheet A. For sure, user has to click the message whether to save sheet B. Below is the code written. Pls enlighten me.
Dim VerR As Workbook
Dim VerRDest As Worksheet
Dim VerRMaxR As Range
Application.ScreenUpdating = False
XLS = Cells(16, 5)
Workbooks(XLS).Activate
Sheets("ROLLER").Select
Path = Cells(18, 5)
NoR = Cells(17, 5)
Workbooks.Open Filename:=Path
Set VerR = Workbooks(XLS)
Sheets("Stat_1").Select
y = 3
i = 4
Do While (Cells(i, 1) <> "")
i = i + 1
Loop
m2 = i - 1
For x = 4 To m2
If (cells(x,2)>5) Then
y = y + 1
TF = True
If TF Then
Cells(y, 6) = Cells(x + 1, 1)
Cells(y, 5) = Cells(x + 1, 2)
End If
End If
Next x
Set VerMax1 = ActiveSheet.Range(Cells(4, 5), Cells(y, 6))
VerMax1.Copy
ActiveWorkbook.Close
Set VerRDest = VerR.Worksheets("ROLLER")
Set VerRMaxR = VerRDest.Range(Cells(4, 3), Cells(y, 4))
VerRMaxR.PasteSpecial , Paste:=xlPasteValues
我的目标是,在不影响来源工作手册的情况下,保持价值。 Pls帮助。 感谢。 我确实赞赏你的想法。 我是最后的。