我无法让我的副本正常工作。我需要它使用“A”单元格的位置作为要复制的起始单元格,然后让 .end(xlup) 从下到上查找单元格到“A”单元格位置,并仅将带有数据的单元格复制到 wbVer(省略空白单元格)。
With wbVer.ws(1)
for each ws in wbCs.sheets
If instr(1, ws.name, "value") then
Set acell = ws.Cells.Find(What:=strPhone, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not acell Is Nothing Then
Set firstRange = wbkVer.ws("CSV").Range("A" & .Rows.Count).End(xlUp).Offset(1, 0).Resize(acell.Rows.Count, 1)
Set rngCSPhcell = .Range(acell.Offset(1, 0)).End(xlUp).offset(-1,0) '<---this isn't right
rngCSPhcell.Copy
firstRange.PasteSpecial xlPasteValues
End if
End if
End With