+ Reply to Thread
Results 1 to 6 of 6

Macro - If adjacent cell contains any data, then copy data from another cell. Possible?

  1. #1
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Macro - If adjacent cell contains any data, then copy data from another cell. Possible?

    Hi,

    I wondering if it is possible for a macro to recognise whether or not there is text in an adjacent cell, and if there is, then to copy data from another adjacent cell.

    For example, because there is data in C2, data from A2 has been inputted into B2. And any blank cells are left alone.


    a b c d e
    ref1 (cell A2 data here) DATA DATA DATA
    ref1

    Any ideas/help would be very much appreciated.
    Last edited by BPSJACK; 07-15-2014 at 06:04 AM.

  2. #2
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Macro - If adjacent cell contains any data, then copy data from another cell. Possible

    Try this code...
    It only covers 100 cells.. you can adjust it...

    Please Login or Register  to view this content.
    Don't forget to click *

  3. #3
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Re: Macro - If adjacent cell contains any data, then copy data from another cell. Possible

    That works great, however is it possible to tweak the code so the macro only looks for populated cells to the right of cells in column B only.

    For example; the code above will populate B2 because there is data in A2. But I'd like to populate B2 only if there is data in C2. If C2 is empty I would want B2 to remain empty also.

    Is there a way to achieve this?

  4. #4
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Macro - If adjacent cell contains any data, then copy data from another cell. Possible

    Dear BPSJACK,

    Try below

    Please Login or Register  to view this content.
    Regards,
    Nandkumar S.
    ---------------------------------------------------------------
    Don't forget to Click on * if you like my solution.

  5. #5
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Re: Macro - If adjacent cell contains any data, then copy data from another cell. Possible

    Fantastic, works like a charm. Thank you!

  6. #6
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Macro - If adjacent cell contains any data, then copy data from another cell. Possible

    You're welcome. Glad to help you.

+ 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 to copy data from one cell to another if adjacent cell meets certain requirements?
    By rrokicki in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-08-2016, 07:41 AM
  2. Copy Cell data if adjacent cell is empty
    By rflorentino in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-12-2014, 02:34 PM
  3. [SOLVED] match cell data & copy adjacent data
    By moin in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-24-2013, 01:46 AM
  4. [SOLVED] Copy adjacent cell data based on ranged criteria.
    By Nneakz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-05-2013, 03:30 PM
  5. Find data and copy adjacent cell
    By hockeyadc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2012, 02:35 PM

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