+ Reply to Thread
Results 1 to 4 of 4

Find certain word, copy and paste cell in previous row if previous row is blank

  1. #1
    Registered User
    Join Date
    11-02-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    28

    Find certain word, copy and paste cell in previous row if previous row is blank

    I need help with a macro. I want to do a search for a particular word in a certain column, then if the previous column is blank, copy and paste it.

    This example, if column C contains the word dog anywhere AND column B cell preceding it is blank, copy and paste the cell into the previous column. If column B contains any info, do nothing.

    The dashes are BLANK spaces to keep the columns matched up

    Start With:
    A ---- B ---- C
    Test -------- The Dog is happy
    Test - Five - The dog has a bone
    Test -------- The cat is sad

    Changes to:
    A ---- B ----------------- C
    Test - The Dog is happy -- The Dog is happy
    Test - Five --------------- The dog has a bone
    Test ---------------------- The cat is sad
    Last edited by steven_e; 06-19-2013 at 10:18 AM.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,754

    Re: Find certain word, copy and paste cell in previous row if previous row is blank

    Hi Steven. Try:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-02-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Find certain word, copy and paste cell in previous row if previous row is blank

    How would I add additional words to the search?

    So instead of just dog, I can add other words in the future? Like bird, cow, etc. but keeping the column and everything else the same

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,754

    Re: Find certain word, copy and paste cell in previous row if previous row is blank

    You can add the additional words to the following line by using 'Or'.
    Please Login or Register  to view this content.
    For example, if you want to also search for "bird" and "cow", the code would look like this:
    Please Login or Register  to view this content.

+ 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