+ Reply to Thread
Results 1 to 3 of 3

Macro - Copy First Instance to Different Sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    06-15-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2003
    Posts
    23

    Macro - Copy First Instance to Different Sheet

    I have a spreadsheet that contains a Revision Check criteria (Column AE). If the same number appears in column A twice, the value for Column AE will be 2. I would like to create a macro that will move the first instance (based on column A) to another sheet. I believe using a For and If/Then statement will work but I am having trouble making it.

    Example:

    Sheet 1 has values in Column A in Rows 1-20
    Sheet 1 has two values in Column A that are the same (other info is different), which appear on rows 10 and 20.
    Sheet 1 will have the value "2" in Column AE for these rows, and only these rows.
    I would like to move the information from Row 10 into the next blank row of Sheet 2.

    **My thinking is an IF statement would cycle through the sheet one row at a time. The value in AE is based on a COUNTIF formula (=countif(A$2:A$20,A2), so once the first instance is moved the value in Cell AE20 will change from 2 to 1 and therefore will not be moved when the macro gets to it.

    Thanks for your help.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro - Copy First Instance to Different Sheet

    an attached sample may be helpful

  3. #3
    Registered User
    Join Date
    06-15-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Macro - Copy First Instance to Different Sheet

    Please see attached. The Sheet1-Before is the original data. Sheet2 and Sheet1-After show the results after the macro has run.

    Thanks.
    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