简体   繁体   中英

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.
  2. the last row will be with reference to column N starting from cell N10..

any suggestions from SO team?

    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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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