简体   繁体   English

使用单元格引用从特定行号复制到最后一行

[英]copy till last row from specific row number with cell reference

I have the below code where I need to make it work as below.我有下面的代码,我需要让它按如下方式工作。

  1. copy from row 10 till last row with value.从第 10 行复制到带有值的最后一行。
  2. the last row will be with reference to column N starting from cell N10..最后一行将参考从单元格 N10 开始的 N 列。

any suggestions from SO team? SO团队有什么建议吗?

    wbSource.Sheets(SITE_TEMPLATE).Rows(10).EntireRow.Copy wbMaster.Sheets(SITE_TEMPLATE).Range("A" & insertRow2)
    insertRow2 = insertRow2 + 1

Try this:尝试这个:

Sub test()

    Dim LastRow As Long

    With Workbooks("wbSource").Worksheets("SITE_TEMPLATE")

        LastRow = .Cells(.Rows.Count, "N").End(xlUp).Row

        .Rows(10 & ":" & LastRow).EntireRow.Copy wbMaster.Sheets(SITE_TEMPLATE).Range("A" & insertRow2)

        insertRow2 = insertRow2 + 1

    End With

End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM