+ Reply to Thread
Results 1 to 3 of 3

Paste into specified cell if empty, if not go to next empty in row

  1. #1
    Registered User
    Join Date
    02-17-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Question Paste into specified cell if empty, if not go to next empty in row

    OK -- working on a macro that first copies a selected range from sheet one to sheet two. Then I want to average the rows and move the averaged numbers to (as values) to a specified location. I will then go back to sheet one and repeat this -- however when the number is moved to the specified location I want the macro to only paste in that location if the cell is blank -- if a value is already there, then go to the next cell in the row -- and repeat the procedure until a blank cell is found for pasting.

    I have no problems getting macro to copy and past appropriately into sheet 2 then average -- but do not know how to do the vba code for finding the blank/empty cell.

    e.g. Copy A6, past special as vale into A16 if empty, if not empty, go to A17, etc.

    What is the VBA code to do this -- am using excel 2007 and 2010. Thanks for your help.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Paste into specified cell if empty, if not go to next empty in row

    Hello Dan23cd,

    Welcome to the Forum!

    When asking questions about macros, you should provide either the code you have questions about or the workbook. Generally, the workbook is the best of the two options.

    To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.

    File Manger Pic
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-17-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Smile Re: Paste into specified cell if empty, if not go to next empty in row

    I have attached a workbook in which I would like to do the following -- number ranges are selected on sheet 1 and transferred to sheet 2 -- I have highlighted the numbers that were selected -- this must always be done by the user. It is done by a series of macros using the keyboard keys a,s,d,f and g. These macros then average the correct values and put them in a temporary place on sheet 2. Macro6 -- keyboard shortcut h is where I need help. I want the averages moved to the locations shown in sheet 2 -- but if that row is filled, then paste into next row. Otherwise I have to use a different macro each time, making it much more cumbersome.

    So can someone look at the macro defined by the "h" on the keyboard and give me a way to paste the numbers into the next blank row.

    Once I understand how this is done -- I may simply put in the earlier macros as would be ultimately simpler -- I have to move the values now so that when I go back the the sheet 1 and select the next group of 5 ranges, it will not overwrite what is already there.

    If it helps to run some of the macros to see what is happening --select the range defined by W57..Y61, hit control a -- then down to the next highlighted, hit control s... etc until 5 selections are made. --ultimately, this will then be repeated with another set of 5 numbers, until the worksheet analysis is completed.
    Attached Files Attached Files

+ 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