Results 1 to 3 of 3

Thread: VBA copy last row data of one sheet col B of workbook to another workbook sheet col A

  1. #1

    VBA copy last row data of one sheet col B of workbook to another workbook sheet col A

    Dear all,
    I would need a modification of the VBA code in attached file "Output" in order to copy paste the data of the source sheet/file ("Source") starting in column B into another workbook sheet, but starting the output in column A!
    So far it copies the data also starting in column B of the output file/sheet , but it should start at column A.
    I am not able to figure out what needs to be modified.
    Thanks a lot for any support
    Best regards
    megaheinz
    Attached Files Attached Files

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,970
    Untested:
    After setting ws add the line:
    wsUsedRangeColmCount = ws.UsedRange.Columns.Count
    then change:
    .Range("B" & FromlastRow).EntireRow.Copy Destination:=nws.Range("A" & ToLastRow)
    to:
    .Range("B" & FromlastRow).Resize(, wsUsedRangeColmCount - 1).Copy Destination:=nws.Range("A" & ToLastRow)
    You were copying the entire row, which includes the blank column A.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Hello p45cal, thank you much for your quick reply; your suggestion works after inserting also a row "Dim wsUsedRangeColmCount As Variant".

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •