迭代副本&根据单元格内容粘贴VBA宏

时间:2016-01-07 12:05:01

标签: vba excel-vba if-statement copy-paste iterated-function

早上好,

请查看我的问题上下文的照片,我也尝试启动VBA代码 - 任何帮助将不胜感激! My truncated data set - 申请和项目数量不详。

我正在尝试解决项目部署中可能存在潜在冲突的问题。我目前正在处理的标准是任何一方28天(单元格K2),这可能会更改为14或7天。

用于录制'碰撞'的My Current宏如下:

`Dim i As Integer
i = 2
Do While i < ActiveSheet.UsedRange.Rows.Count + 1

Range("B1").Offset(i - 1, 0).Copy
Range("H2").Select
ActiveSheet.Paste


i = i + 1
Loop

Application.ScreenUpdating = True

MsgBox i

End Sub'

我想在另一个宏中运行,其中Application与上面的那个相同,并且D列中有一个'碰撞'(这只是一个= IF(AND ...公式)的内容得到的格式为in this image。这仅适用于第一组冲突。

我已经开始编写一些代码,基于以前的VBA而已经卡住,任何帮助都非常感激。

`Sub clashcompile()
Dim lastrow As Long
Dim lastcol As Long
Dim i As Long


With ActiveSheet

    lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
    For i = lastrow - 1 To 2 Step -1

        If .Cells(i + 1, "A").Value = .Cells(i, "A").Value And _
            .Cells(i + 1, "B").Value > .Cells(3, "H").Value And _
            .Cells(i + 1, "B").Value < .Cells(4, "H").Value And _
            .Cells(i + 1, "D").Value = .Cells(2, "L").Value Then'

我被困在这之后..

请询问是否需要澄清。

提前致谢。

0 个答案:

没有答案
相关问题