+ Reply to Thread
Results 1 to 8 of 8

Find the last row on column A -> copy the row from A unti H-column

  1. #1
    Registered User
    Join Date
    02-17-2021
    Location
    Helsinki, Finland
    MS-Off Ver
    365
    Posts
    31

    Question Find the last row on column A -> copy the row from A unti H-column

    I have a Purchases.xlsx (wsDest) from which I want to transfer only the last row information from A to H column, to an other wsCopy Excel (Receps.xlsx).

    The problem:
    Everytime I run the macro, it copies everything - not just the last row, which I would like it to copy.
    This is problematic as the Destination file is updated by other users and once I hit the Macro again on wsCopy excel, the macro re-writes everything to wsDest Excel.

    Needed solution
    The macro should find the last row from wsCopy excel and copy that rows information from A:H columns to further pasted to wsDest excel.

    Please Login or Register  to view this content.
    I believe I need to change something on point 3 which I bolded. but what is it?
    Last edited by Tsinos; 12-27-2022 at 02:11 PM. Reason: solved with a smile

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2505
    Posts
    2,790

    Re: Find the last row on column A -> copy the row from A unti H-column

    Please Login or Register  to view this content.
    You are copying from A4 here, if you want only the last row you would have to use the last row next to A also.
    Last edited by skywriter; 12-23-2022 at 05:57 PM. Reason: Wrong code tags.

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,097

    Re: Find the last row on column A -> copy the row from A unti H-column

    It seems that destination is column "A"
    See next code NOT TESTED


    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  4. #4
    Registered User
    Join Date
    02-17-2021
    Location
    Helsinki, Finland
    MS-Off Ver
    365
    Posts
    31

    Re: Find the last row on column A -> copy the row from A unti H-column

    As the destination file's last row should be found based on column A. I changed the code
    Please Login or Register  to view this content.
    But the code copies only one cell to the last row of column H.

    FURTHER INFO:
    A sample of the Excel from which the last row, based on column A information, is enclosed.

    Destination Excel is the same format but information is only until column H. This is because Sales people has their Excels (here the copy info from) which they fill in and the destination Excel gathers all their info with a button click (what I am trying to achieve here) to the Destination Excel.

  5. #5
    Registered User
    Join Date
    02-17-2021
    Location
    Helsinki, Finland
    MS-Off Ver
    365
    Posts
    31

    Re: Find the last row on column A -> copy the row from A unti H-column

    I noticed as well, but I'm not so familiar to the ranges as I'm quite beginner.
    If I will refer to A4 I'm referring to the row number. The challenge for me is, that I should refer the the last row, which has filled in information on column A and copy that to the last row, on another Excel, to the first row which is empty.


    modified:
    wsCopy.Range("A:H" & lCopyLastRow).Copy
    but:
    Attachment 810855

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,038

    Re: Find the last row on column A -> copy the row from A unti H-column

    The macro should find the last row from wsCopy excel and copy that rows information from A:H columns to further pasted to wsDest excel.
    Simply...As per skywriter suggested in post 4
    Please Login or Register  to view this content.
    Last edited by Sintek; 12-27-2022 at 05:37 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  7. #7
    Registered User
    Join Date
    02-17-2021
    Location
    Helsinki, Finland
    MS-Off Ver
    365
    Posts
    31

    Re: Find the last row on column A -> copy the row from A unti H-column

    Quote Originally Posted by sintek View Post
    Simply...As per skywriter suggested in post 4
    Please Login or Register  to view this content.

    Yes, understood where Skywriter refered to but I could not figure it out.
    Thanks for writing the code open to me, I learned from it as could see the code.

    NOW the code works perfectly! Thank you ALL!

  8. #8
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,038

    Re: Find the last row on column A -> copy the row from A unti H-column

    .........................
    Thanks.png

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VB Code to find certain text in column and copy digit part in diff column
    By rmomin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-09-2021, 07:12 AM
  2. [SOLVED] Excel VBA Macro - Find Word and Select that Column to Column D and copy
    By MsBBStacker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2015, 12:04 AM
  3. Replies: 4
    Last Post: 01-07-2015, 08:29 PM
  4. Replies: 5
    Last Post: 08-01-2014, 04:30 PM
  5. [SOLVED] Macro to find the empty cell in a column and copy a adjacent row to another column.
    By naga in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-18-2013, 07:44 AM
  6. [SOLVED] find bold number in Column A and copy range to column C
    By joek13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-24-2012, 10:32 AM
  7. Replies: 1
    Last Post: 05-06-2011, 03:08 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1