+ Reply to Thread
Results 1 to 9 of 9

Copying to first empty row?

  1. #1
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    548

    Copying to first empty row?

    I finally have the copying aspects of my macro working, after much help here thanks. To discuss the next stage I've attached a much simplified version of both source and destination workbooks used.

    The macro currently copies data from Source-Simplified.xlsm to fixed row 8 of WalkIndex-Extract.xlsm
    Please Login or Register  to view this content.
    I want to edit that to copy instead to the first row in which col A is empty, row 4 in my example. The first run would therefore enter two cells into row 4, instead of row 8. And so on, as the number of rows increases.

    This code finds the first empty row OK.

    Please Login or Register  to view this content.
    But attempts to use 'FirstEmpty' in Sub Extract_Simplest() have so far defeated me and any help would be appreciated please
    Attached Files Attached Files
    Terry, East Grinstead, UK
    Excel 365, Win 10 Pro, i7 PC, 4.0 GHz

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

    Re: Copying to first empty row?

    Please Login or Register  to view this content.
    Last edited by Sintek; 01-07-2020 at 12:55 PM.
    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!!!

  3. #3
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    548

    Re: Copying to first empty row?

    Many thanks @sintek, appreciate the fast reply.

    Your code correctly copies source B5 to C4, but B27 should go to D4, not C5. However, you would not have been able to spot this by running your macro because I must have saved the source while B27 was empty, sorry!

    As you've done the hard part I was able to make the two minor edits and it now works fine, thanks. I've attached updates of the sheets.

    Please Login or Register  to view this content.
    Next minor step will be to add a new line each time, to keep TOTALS below the last entry. And then the slog of extending the simplified to the full version. But I'm optimistic of having a working macro soon, which I can then apply to a hundred or two source files.
    Attached Files Attached Files

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

    Re: Copying to first empty row?

    TOTALS below the last entry
    Totals of what...Nothing to sum?

  5. #5
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    548

    Re: Copying to first empty row?

    Quote Originally Posted by sintek View Post
    Totals of what...Nothing to sum?
    That's just text at present, for this simplified version. The full macro counts all rows from row 2 downward to the last one.

    I've added a line that keeps the space.

    Please Login or Register  to view this content.

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

    Re: Copying to first empty row?

    Okey dokie...Thanks for rep +

  7. #7
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    548

    Re: Copying to first empty row?

    This line, to insert a blank row after the last entry was pasted, worked fine in the simplified version I posted earlier. But in the full version it now highlights 'xlFormatFromRightOrAbove' with the error "Compile error: Variable not defined".

    No variable was defined before. And isn't this a parameter, not a variable anyway?

    Please Login or Register  to view this content.

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

    Re: Copying to first empty row?

    Think you should upload a workable file with your actual requirement for this TOTAL...Your solution might not be the best alternative...
    Perhaps you should start a new thread depicting your requirement, as it no longer pertains to this thread...

  9. #9
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    548

    Re: Copying to first empty row?

    Not exactly sure how, but I found a winning combination after a couple of hours of experiment and happily that snag is now resolved thanks.

    You’re right, I realise now that I should have started a new thread, given that I’d already set this one as solved. There are a few others and I’ll post separately if I can’t fix them myself.

+ 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] Copying values into empty cells below
    By kban in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2017, 12:06 PM
  2. Copying into empty cells
    By butlerar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2014, 09:29 PM
  3. [SOLVED] Copying to next empty row
    By 4evra in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2013, 07:17 PM
  4. Copying to Next Empty Row
    By Pasha81 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2009, 01:27 PM
  5. Copying a value to the next empty cell
    By Arney in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-11-2009, 12:57 PM
  6. copying a range to first empty row is copying over data
    By jseufert in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2009, 03:45 AM
  7. copying empty cells as empty
    By sjhonny in forum Excel General
    Replies: 2
    Last Post: 01-17-2007, 06:52 AM

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