+ Reply to Thread
Results 1 to 13 of 13

copy row data to another worksheet if column two data begins with I/

  1. #1
    Registered User
    Join Date
    03-28-2012
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2013
    Posts
    14

    copy row data to another worksheet if column two data begins with I/

    Good evening everyone.

    I found an old thread in the forum that almost matches my concern. However, despite trying to tweak the code to suit my specific needs, I cannot make it work the way I like it to..

    I hope you guys can assist me on this.

    Problem:

    If data on Column B begins with "i/", then copy data on columns A, B, C, D & G only in another worksheet in the same order. Please see image for my concern.

    excel problem.jpg

    I have also attached the sample answer I found in this older thread: http://www.excelforum.com/excel-prog...fic-range.html

    Move As.xls

    Thank you very much!

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: copy row data to another worksheet if column two data begins with I/

    Try the attached. I have assumed that the raw data is on sheet1 and output would be on sheet2.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-28-2012
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: copy row data to another worksheet if column two data begins with I/

    Wow!

    Thanks for the quick reply! I tested the code you sent and it works! However, since I will be transferring the code to my actual worksheet, I suddenly worried if changing the worksheet names will have an effect on the code? I have attached the excel file you made, AB33, showing Sheet 1 as "Unit Prod" and Sheet 2 as "Master List" to show you what my actual worksheet looks like. Both have pre-existing column headings on row 5. There are other worksheets in file as well.

    Hope you can ease my mind on this?

    Thanks again for the prompt response! :Move As.xls

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: copy row data to another worksheet if column two data begins with I/

    Amended code:
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-29-2015
    Location
    Sweden
    MS-Off Ver
    2010
    Posts
    10

    Thumbs up Re: copy row data to another worksheet if column two data begins with I/

    Hi, AB33!

    I've been looking for something like this for a week, though I'd like to know, is it possible to replace the ones copied earlier? instead of just creating new rows.
    For example : I would need to have it start copying to B4 and down every time.

    Best Regards
    Kimzi

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: copy row data to another worksheet if column two data begins with I/

    Kimzi,
    Sorry, I would not able to reply on this thread as it is against forum's rule to post on someone else's thread.
    Please start your own thread and attach a sample. I will look out for your thread and write you a code.

  7. #7
    Registered User
    Join Date
    01-29-2015
    Location
    Sweden
    MS-Off Ver
    2010
    Posts
    10

    Re: copy row data to another worksheet if column two data begins with I/

    I'm really sorry, I will do so!

  8. #8
    Registered User
    Join Date
    03-28-2012
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: copy row data to another worksheet if column two data begins with I/

    Hi AB33!!

    Your code works perfectly!!!

    Thank you! Thank you!

    The code runs for 15 seconds since it attempts to get the data from columns "A", "B", "C", "D" & "IN", and there are 1400 rows in the worksheet.

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: copy row data to another worksheet if column two data begins with I/

    Faster code:
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    03-28-2012
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: copy row data to another worksheet if column two data begins with I/

    wow.

    From 15 seconds to a blink of an eye.

    The new code you gave me rocks!

    However, I encountered 2 errors one of which I was able to fix (I think), while the other eludes me:

    1) the new, faster code transferred all the data to the Master List worksheet as expected but it erased all the column headings in the Master List worksheet.
    My solution: remove this line of code:
    .UsedRange.Offset(1).ClearContents
    I hope it is correct.

    2) My column A data are all 9-digit numbers that begin with 2-4 zero digits like so: 000123456. the new code still copied the data as expected but the result now just looks like this: 123456. The zeroes at the beginning were all removed.

    Hope you can still assist, AB33!

  11. #11
    Registered User
    Join Date
    01-29-2015
    Location
    Sweden
    MS-Off Ver
    2010
    Posts
    10

    Re: copy row data to another worksheet if column two data begins with I/

    Hi, I dunno if it's ok for me to reply but if you write:

    Please Login or Register  to view this content.
    It'll start removing data from line 6 and down.

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: copy row data to another worksheet if column two data begins with I/

    Kimzi has answered your first question. I have amended the code for the second request.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    03-28-2012
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: copy row data to another worksheet if column two data begins with I/

    Thank you very much AB33 & Kimzi! It works flawlessly now.

+ 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] copy rows where column data begins with an alpha character
    By shaz0503 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-22-2013, 10:05 PM
  2. [SOLVED] copy data from cells in a column on one worksheet to a single cell in another worksheet
    By jpsnickers in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-03-2013, 07:02 PM
  3. [SOLVED] How to copy all character till first space which begins with "RXO" data
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-06-2013, 07:35 AM
  4. Copy & Paste Column with Data in the next available column in the same worksheet
    By BruceBane73 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-16-2013, 12:07 AM
  5. Copy data from column that begins with data to new sheet
    By Snapdaddy in forum Excel General
    Replies: 1
    Last Post: 04-16-2006, 07:30 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