+ Reply to Thread
Results 1 to 7 of 7

Copy last non empty cell in column A and paste with offset.

  1. #1
    Registered User
    Join Date
    09-10-2020
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    2

    Copy last non empty cell in column A and paste with offset.

    Hello everyone,

    I want to find and copy last non empty cell in column A and paste it with offset. Problem is that in column A are formulas (Range A1:A18).
    For range A1:A8 formulas are numbered. I want copy last cell with numbered formula, which in this case is A8. Unfortunately code copy cell A18, which is last cell with formula.

    Code is as follows:
    Sub test()
    Range("A" & Rows.Count).End(xlUp).Copy
    Range("A" & Rows.Count).End(xlUp).Offset(0, 8).PasteSpecial (xlPasteValues)

    End Sub

    I attached excel file.

    Could you help me?
    Attached Files Attached Files

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Copy last non empty cell in column A and paste with offset.

    Hi Dawid18db & welcome to the forum,

    Try the below code
    Please Login or Register  to view this content.
    Last edited by nankw83; 09-10-2020 at 09:23 AM.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,880

    Re: Copy last non empty cell in column A and paste with offset.

    Hi & welcome to the board.
    How about
    Please Login or Register  to view this content.

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Copy last non empty cell in column A and paste with offset.

    After seeing Fluff's code & re-reading your post, if you're only looking for the last cell you need to change the below line

    @Fluff, nice simple code

    Please Login or Register  to view this content.

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

    Re: Copy last non empty cell in column A and paste with offset.

    Another Option perhaps...
    Please Login or Register  to view this content.
    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!!!

  6. #6
    Registered User
    Join Date
    09-10-2020
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    2

    Re: Copy last non empty cell in column A and paste with offset.

    In the meantime I kept fighting to solve this problem myself. Successfully! Code below.

    Sub test()
    Cells(Application.Evaluate("MAX(IF(A1:A2000<>"""",ROW(A1:A2000)),0,1)"), "A").Copy
    Cells(Application.Evaluate("MAX(IF(A1:A2000<>"""",ROW(A1:A2000)),0,1)"), "A").Offset(0, 8).PasteSpecial (xlPasteValues)
    End Sub

    I also tested your propositions - all of them working properly. Many thanks.

  7. #7
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Copy last non empty cell in column A and paste with offset.

    Glad we were able to help ... If that takes care of your question, please mark this thread as [SOLVED] from the Thread Tools above your first post & consider Add Reputation to those who have helped by clicking the star under their usernames

+ 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. copy paste value of different cells to next empty cell in a given column
    By dyoung785 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-16-2019, 04:21 PM
  2. Copy paste specific range to last non empty cell in Column A different sheet
    By realrookie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2016, 04:20 PM
  3. Copy data and paste to another column incrementing that column to next empty cell
    By edens2021 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2015, 11:43 AM
  4. copy and paste data in another column in next empty cell
    By dilippyare in forum Excel General
    Replies: 3
    Last Post: 11-24-2014, 11:11 AM
  5. Vba - find next empty column, insert column, copy paste values & copy paste formulas
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2012, 12:43 PM
  6. Replies: 3
    Last Post: 03-15-2012, 05:16 AM
  7. Copy values from cell in active row, paste in first empty cell in spesified column.
    By Test123Test in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-19-2012, 05:20 PM

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