我已经研究了以下代码,该代码根据列I中的条件复制了1个单元格。我知道如何为-6列设置偏移量,当我需要单元格Offset(0,-6)和Offset( 0,-5)同时作为范围而不是偏移。你能帮忙吗?就是这一行:Range("I" & i).Offset(0, -6).Copy
,在这里我需要从col C和D到一系列单元格,而不是简单的offset(这给了我一个单元格)。
Sub xxx()
Dim WB As Workbook
Dim ZXC As Worksheet
Dim INF As Long, RSP As Long
Set WB = Workbooks("test.xlsm")
Set ZXC = WB.Sheets("MMLPLC")
Set VBN = WB.Sheets("VBN")
ZXC.Activate
INF = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To INF
If Range("I" & i).Value = "Further Information Needed" Then
Range("I" & i).Offset(0, -6).Copy
VBN.Range("C" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
End If
Next i
VBN.Activate
Application.CutCopyMode = False
End Sub