+ Reply to Thread
Results 1 to 13 of 13

Finding the first empty cell

  1. #1
    Registered User
    Join Date
    09-17-2009
    Location
    Brazil, Rio de Janeiro
    MS-Off Ver
    Excel 2007
    Posts
    10

    Finding the first empty cell

    My problem is that I have to copy and paste some datas under anothers but I don't know the code to do so; I mean, the code to paste on the first empty cell under the previously used cell.


    Please Login or Register  to view this content.

    When I do that the next paste (the datas from "E5:G5") will be from the last line of the last list pasted above (the datas from "A5:C5"). This way I always loose the last data of the previoulsy list.

    Thanks for the help,

    Luiz
    Last edited by Luiz; 09-21-2009 at 11:20 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Finding the first empty cell

    How about this:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-17-2009
    Location
    Brazil, Rio de Janeiro
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Finding the first empty cell

    JBeaucaire,

    thanks, but it didn't work......

    the thing is that I need to copy an entire set of data of the columns A to C and paste it on the BF column. Than, copy data from the columns E to G and paste them on BF column under the data from A to C.
    The macro I've posted does it, but the last line of the A to C data is always lost, because the data of E to G columns are pasted over it.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Finding the first empty cell

    The two lines of code I provided do exactly that. Here's another:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-17-2009
    Location
    Brazil, Rio de Janeiro
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Finding the first empty cell

    Thanks JBeaucaire
    problem solved!

  6. #6
    Registered User
    Join Date
    09-17-2009
    Location
    Brazil, Rio de Janeiro
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Finding the first empty cell

    Thanks for helping JBeaucaire, but I didn't make it for the 14 times that I need......... it does not even finish.... stops during the process.......

    Please Login or Register  to view this content.
    Here it is the Macro I've built from the one you suggest tha works when it's just the first 2 lines, but when I replicate it to all of them it stops on the third line(the range "I5:K5").

    what should I change so this works?

    Thanks

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Finding the first empty cell

    It's xlDown as in "excel-down" ...you put in a 1 (x1Down) instead on a lowercase "l", not the same thing.

    Put Option Explicit at the top of the module and it will point out typos like this for you.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Finding the first empty cell

    If you put Option Explicit at the top of every module, you wouldn't have those kinds of problems.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Registered User
    Join Date
    09-17-2009
    Location
    Brazil, Rio de Janeiro
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Finding the first empty cell

    is this correct?

    Please Login or Register  to view this content.
    Cause it didn't worked..... keep stoping in the third line not even finishing the macro........
    about the module you've said I didn't unterstand it..... where i can see it? to the down left?

  10. #10
    Registered User
    Join Date
    09-17-2009
    Location
    Brazil, Rio de Janeiro
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Finding the first empty cell

    aaaaa.............. thanks guys
    It worked perfectly!!! Thanks very much.

    but the Module thing, I didn't find it...........

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Finding the first empty cell

    You code is in a code module.

    As the very first line, before any procedures or anything else, put this line:

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    09-17-2009
    Location
    Brazil, Rio de Janeiro
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Finding the first empty cell

    Would look like this?

    Please Login or Register  to view this content.

  13. #13
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Finding the first empty cell

    No; it goes above EVERYTHING, and it's not a comment.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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