Copy Selected Range Of Cells

Important Notice

Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • I know this question may have been asked before.I would like to copy range of cells from sheet1 starting from A5 to column L5 to the end of the last used cell.This should be copied to another workbook named book2 at A5.

  • Re: Copy Selected Range Of Cells

    LR = Cells(Rows.Count, "A").End(xlUp).Row
    range("A5:L" & LR).copy book2.sheet1.range("A5")
  • Re: Copy Selected Range Of Cells

    You don't say whether you have the workbook open or not. Also you are taking advice from a member who never declares their variabales. Not a good practice.

    Use this example if the workbook is closed. Change the path to suit.

    Take care


    Sub test()
    Dim Wb1 As Workbook
    Dim wb2 As Workbook
    Set Wb1 = ThisWorkbook
    Set wb2 = Workbooks.Open("C:\Users\HYMC\Excel\Helping\ADel\book2.xls")
    Wb1.Sheets(1).Range("A5:A" & Wb1.Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row).Resize(, 12).Copy wb2.Sheets(1).Range("A5")
    End Sub
  • Re: Copy Selected Range Of Cells

    Quote from skamat;651544

    I am getting compile error, variable not found.

    attach a sample file or your complete code

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!