+ Reply to Thread
Results 1 to 6 of 6

Macro to scan column and copy corresponding cell

  1. #1
    Registered User
    Join Date
    06-26-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Macro to scan column and copy corresponding cell

    Hi,

    I'm trying to write a macro that scans a column in a worksheet, and if it finds a cell that meets a certain criteria, it pulls a cell from a different column (but the same row) into a different worksheet.

    To simplify it:
    I need a macro to scan the entire Column C on 'Sheet1' for a cell that has the value '1'. If it finds a cell with this value, it copies the value from the same row in Column A and pastes it in the last active cell in 'Sheet2'. The macro then continues down Column C in 'Sheet1' searching for the next cell with the value '1' to copy the corresponding value in Column A into the next row in 'Sheet2', etc...

    If someone could help me with this, it would be much appreciated.
    Thanks.
    Last edited by RobbieMoulton; 06-27-2011 at 12:34 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to scan column and copy corresponding cell

    You can apply an AutoFilter to your sheet1 table, filter column C by "1", then copy all the visible column A values all at once to sheet 2. By hand that would take all of... 10 seconds.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-26-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Macro to scan column and copy corresponding cell

    Thanks. I know this is quick, but manual. This is just one step in a very long macro, apart of some reporting that needs to be done on a regular basis, so I'm wanting this as part of the macro. Any help with the VBA coding to do this would be great.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to scan column and copy corresponding cell

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-26-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Macro to scan column and copy corresponding cell

    Perfect. Thank you very much, JBeaucaire!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to scan column and copy corresponding cell

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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