Closed Thread
Results 1 to 9 of 9

Find first empty cell

  1. #1
    Registered User
    Join Date
    07-15-2006
    Posts
    13

    Find first empty cell

    Hi,

    I am using the code below to copy and paste data into the first empty cell in a column, reading top to bottom.

    I cannot find a way to change this to the first empty cell in a row, reading left to right.

    Any help?

    Much appreciated.

    Please Login or Register  to view this content.
    Last edited by nomadscot; 06-08-2007 at 01:42 PM.

  2. #2
    Registered User
    Join Date
    07-15-2006
    Posts
    13
    Alternatively, can someone please give me a suggestion for simply copying the contents of a column in one worksheet, and pasting it's value in the first empty column of a second worksheet?


  3. #3
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    nomadscot,

    This will give you the last column used in a row. If you want the first empty cell, just add one.
    Please Login or Register  to view this content.
    Be sure in the future to wrap you code otherwise one of the moderators might lock your post.
    Sincerely,
    Jeff

  4. #4
    Registered User
    Join Date
    01-29-2007
    Posts
    92
    I'm assuming that you know how to switch back and forth between sheets.

    Please Login or Register  to view this content.
    This code will find the first empty column after the last column that has data in it. This means that if column2 is empty but column3 is not, this code will paste the code into column4 not column2.

    Sry i forgot to wrap code

    Cheers
    Schwizer
    Last edited by Schwizer; 06-08-2007 at 01:35 PM.

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Schwizer & nomadscot,

    Please wrap you code or this thread will be locked

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  6. #6
    Registered User
    Join Date
    07-15-2006
    Posts
    13
    Schwizer, Boylejob, thanks for your replies. VBA Noob - my sincere apologies for not wrapping the code.

    Schwizer, the code you gave me doesn't have the required effect.

    I have headers in column A, and the rest is a blank worksheet. However, your code makes it's first paste in column I (ish), and then advances a column evey time I run it - even when I delete the paste from the previous run! (i.e. there is nothing between the headers in column A and the newly pasted column).

    This is what I ran:

    Please Login or Register  to view this content.
    Very much appreciate - thanks again.

    Edit: I also unfortunately find one additional problem with this, which is that I can only 'Paste' the data, and get an error when I try:

    Please Login or Register  to view this content.
    in order to paste the values, which I need to do.
    Last edited by nomadscot; 06-08-2007 at 02:22 PM.

  7. #7
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    nomadscot,

    Is it possible for you to post your workbook so we can see what you are actually trying to do.

    From your code it appears that you are wanting to copy the first 10 rows of Col A on Sheet 3 and put that information in the first empty column after Col A on Sheet 2.

    If I can see what you are actually trying to do, I might be able to be of more help.

  8. #8
    Registered User
    Join Date
    07-15-2006
    Posts
    13
    Hi Boylejob,

    That's very kind of you sir. I'm pleased to tell you that I found a solution! (Or rather, I was provided with a solution )

    In case it might help someone else, I've posted it below. In fact I need to copy and paste values of 801 cells from a column in Sheet 72, to the last empty column in sheet 24, in order to keep a continous log of changes made in the worksheet.

    It wouldn't be possible for me to post the workbook because of it's size, but I've posted the whole routine below. (in fact, it will be called from another macro).

    Any comments gratefully received, and many thanks for your interest.

    BTW, Boylejob - I'm working away all next week, so I won't be able to access the forum during this time.

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Closed for cross posting

    VBA Noob

Closed 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