+ Reply to Thread
Results 1 to 9 of 9

How to copy a cell ontent into next available blank cell in sheet2?

  1. #1
    Registered User
    Join Date
    11-23-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    38

    Question How to copy a cell ontent into next available blank cell in sheet2?

    I have 2 worksheets, let's call them "Sheet1" and "sheet2".

    Sheet 1 has 2 columns (A, and B)

    Ie. "Sheet1:"

    Col A, Col B

    Red
    Green Yes
    Blue
    Yellow
    Orange Yes

    For each entry in Column "B" that has a "Yes" value, I need to copy the color value in column "A" into the next available empty cell in "Sheet2" in column A.

    "Sheet2"

    Col A, Col B

    Red 3
    Blue 5
    Yellow 6


    Final Result:

    Col A, Col B


    Red 3
    Blue 5
    Yellow 6
    Green
    Orange

    Can someone assist in how to do this particular challenge? For Sheet2, I think I'll need a function to determine the first available blank cell in column A.

    Thanks
    Last edited by MelissaGregory; 11-26-2013 at 10:16 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: How to copy a cell ontent into next available blank cell in sheet2?

    Try this:

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    11-23-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: How to copy a cell ontent into next available blank cell in sheet2?

    Thanks Alan!

    Your right on the money!!! Your proposed piece of code worked flawlessly!! Thank you so much!!!

    Hmm, one other question: if I wanted to clear out all the "Yes" values in "Sheet1", but keep the cell formatting/forumulas of that cell in tact, what piece of code could be ammended to the Sub to remove all "Yes" values? Thanks in advance

    Appreciate your help.
    Melissa

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: How to copy a cell ontent into next available blank cell in sheet2?

    Try this:

    Please Login or Register  to view this content.
    I haven't tested this. It was off the top of my head.

    Alan

  5. #5
    Registered User
    Join Date
    11-23-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: How to copy a cell ontent into next available blank cell in sheet2?

    Hi Alan,

    Thanks again....I think your 2nd code works!! Damn, you're good!

    Question though: why didn't you have to declare the worksheet(in this case "Sheet1") via a Dim and Set statement for this particular Sub ams2??

    Me

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: How to copy a cell ontent into next available blank cell in sheet2?

    Because I was only working within the one sheet.

  7. #7
    Registered User
    Join Date
    11-23-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: How to copy a cell ontent into next available blank cell in sheet2?

    Hi Alan:

    All the above works nicely - thanks again for your generous help

    I was wondering for this particular example, if for Column "B" the data values are obtained by VLOOKUP into "Sheet1" using the Column "A" value, what is the VBA syntax to ammend to the code above to copy the VLOOKUP formula from the cell in Column "B" to the copied cell?

    I assume that the code would probably need to be inserted after the copy of the value of Column "A" in Sheet "1" into the next free cell in Column "A" in Sheet "2".

    w1.Range("A" & i).Copy w2.Range("A" & lr2 + 1)


    Thanks!!!
    Melissa

  8. #8
    Registered User
    Join Date
    11-23-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: How to copy a cell ontent into next available blank cell in sheet2?

    I forgot to mention that the VLOOKUP formulas are of course relative, so the look up paramaters would increment by 1 row for each new appended value.

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: How to copy a cell ontent into next available blank cell in sheet2?

    I am a little confused. You want to copy the formula in Column B in Sheet 1 to the next empty row in Sheet 2? Perhaps it might help if you explain your project as if we were standing in line in McDonalds. Even better, would be to attach a sample workbook with before and after situations so that we can understand and tailor the response.

+ 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] Macro copy entire row if any cell frm col A in sheet1 match any cell frm col A in sheet2
    By daillest319 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-28-2013, 03:20 PM
  2. [SOLVED] How to copy data in a cell in Sheet1 to a cell in Sheet2 using =COPY( )?
    By Mr D Relf in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-17-2013, 10:39 AM
  3. [SOLVED] If cell value on Sheet1 not found on Sheet2 copy row to Sheet2
    By Yxx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-18-2013, 04:15 AM
  4. [SOLVED] Need a macro to Copy Cell in Sheet1 to the next empty cell in Column A, Sheet2
    By killerthun in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-16-2012, 01:21 PM
  5. Macro to copy range of cell from sheet1 to sheet2 based on a cell value in sheet2
    By drgwhizz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-25-2012, 10:39 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