Excel VBA - 如果日期匹配,则在列中复制粘贴范围
Excel VBA - Copy Paste Range in column if Date matches
我的宏用于 copy/paste 实时数据以覆盖旧预算。
基本上我想做以下事情:
如果 T6
中的日期 = Range(G6:R6)
中的日期,则将 Range(T10:T30)
复制到 Range(?10:?30)
,其中 ?
是匹配的单元格的列日期。
这应该符合您的要求。以后,您应该分享您目前尝试过的代码。
Dim cell As Range
For Each cell In Range("G6:R6")
If cell.value = Range("T6").value Then
Range(Cells(10, cell.Column), Cells(30, cell.Column)).value = Range("T10:T30").value
End If
Next cell
我的宏用于 copy/paste 实时数据以覆盖旧预算。
基本上我想做以下事情:
如果 T6
中的日期 = Range(G6:R6)
中的日期,则将 Range(T10:T30)
复制到 Range(?10:?30)
,其中 ?
是匹配的单元格的列日期。
这应该符合您的要求。以后,您应该分享您目前尝试过的代码。
Dim cell As Range
For Each cell In Range("G6:R6")
If cell.value = Range("T6").value Then
Range(Cells(10, cell.Column), Cells(30, cell.Column)).value = Range("T10:T30").value
End If
Next cell