将数据范围复制到另一个工作簿

时间:2016-06-28 19:41:31

标签: excel vba excel-vba

我正在尝试将一系列数据从一个工作簿复制到另一个工作簿。 我想复制任何R ?????????在范围A3:A999和它的相应版本从范围D3:D999到另一个工作簿中的下一个可用空白单元格从A2开始为R ?????????和D2为版本号。

这是我到目前为止所做的,但是我一直收到错误,请帮忙。

Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual

iForm = ("Workbook Location path")

workbooks.Open(iForm).Worksheets("Scheduled Forms").Select

Envrange = "A2:D999"
RowNo = 3

For Each C In workbooks("Daily Release Process.xlsm").Worksheets("Applications").Range(Envrange)

    If C.Value Like "R?????????" Then
    workbooks(iForm).Worksheet("Scheduled Forms").Cells(RowNo, 1).Value = C.Value
    workbooks(iForm).Worksheet("Scheduled Forms").Cells(RowNo, 4).Value = C.Offset(0, 3).Value
    RowNo = RowNo + 1
    End If
Next C

ActiveWorkbook.Save

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic    
Application.EnableEvents = True

End Sub

提前谢谢。

1 个答案:

答案 0 :(得分:0)

您需要做的就是将iForm = ("Workbook Location path")更改为iForm = "Workbook Location path"