+ Reply to Thread
Results 1 to 6 of 6

Macro to copy and paste rows based on "text" found in Column A

  1. #1
    Registered User
    Join Date
    11-16-2012
    Location
    college park, maryland
    MS-Off Ver
    Excel 2010
    Posts
    37

    Macro to copy and paste rows based on "text" found in Column A

    I am using the code below to copy data from a sheet named Unix and paste it into a sheet named Demonstration. Currently it is copying the data between
    EO27:HT95. I need to be able to use this macro when rows are added or deleted, therefore


    I would like it to be able to search the file and begin copying the data when it finds the term "CRS" in column A and continuing copying all rows until it reaches the term "Other" in column A.


    Please Please help. I have tried so many different codes and tried asking this so many times. Any help would be greatly appreciated.

    Thank you!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro to copy and paste rows based on "text" found in Column A

    balston2,

    So you want to copy all rows in sheet 'Unix' where column A = "CRS" to sheet 'Demonstration', is that correct?
    If so, this should work for you:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    11-16-2012
    Location
    college park, maryland
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Macro to copy and paste rows based on "text" found in Column A

    Almost. I want it to start copying the rows once it finds the first "CRS" and continue copying all rows after even if CRS is not in column A. I then need it to stop copying the rows once it gets to "Other" in Column A.
    Thanks for you quick responce!

  4. #4
    Forum Contributor
    Join Date
    06-09-2011
    Location
    Germany
    MS-Off Ver
    Excel 2016
    Posts
    194

    Re: Macro to copy and paste rows based on "text" found in Column A

    Hi Bolston,

    unfortunately I am sitting in front of a public computer which does not have excel installed. I hope I did not accidentally mess up the syntax.

    I made some small changes to the macro which should do the trick. In general i prefer not to "activate" sheets to much, but addressing them directly with

    Set XS = Sheets("Unix") 'Source
    Set XT =Sheets("Demonstration") 'target

    Thererfore I have replaced the "activesheet" with either XS or XT. Furthermore I got rid of all those selects

    Please Login or Register  to view this content.
    Hope it works

    Theo
    Remember To Do the Following....
    1. Upload sample files
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.

  5. #5
    Registered User
    Join Date
    11-16-2012
    Location
    college park, maryland
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Macro to copy and paste rows based on "text" found in Column A

    Thanks so much for your responce! I'm trying the code but nothing is happening. I am trying to go through it and find out why.

  6. #6
    Registered User
    Join Date
    11-16-2012
    Location
    college park, maryland
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Macro to copy and paste rows based on "text" found in Column A

    Ok so now the macro is working but not starting the copying at CRS or stoping at other. It just begins copying at E049 and stops at HT117. starting in column EO is perfect that was actually going to be my next question.

    But I need it to start copying in the row that begins with CRS.

+ 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