+ Reply to Thread
Results 1 to 4 of 4

Macro to select and copy entire rows containing text string

  1. #1
    Registered User
    Join Date
    01-18-2016
    Location
    UK
    MS-Off Ver
    2010
    Posts
    2

    Macro to select and copy entire rows containing text string

    Hi all,

    I need a macro that can look through a table of data, select certain rows and copy them to another sheet.

    It needs to look in column A and where it finds "1" then select the entire row then copy all selected.

    Any ideas?

    Thanks,

    LVall

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Macro to select and copy entire rows containing text string

    Hi LVall and welcome to the forum,

    This problem takes me about 5 minutes to write the macro and post it back to you. It is easier if you supply a sample of what you data looks like. To attach a sample, click on "Go Advanced" and then the paper clip icon above the advanced message box. You give us the sample we spend 5 minutes to give back the VBA.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    01-18-2016
    Location
    UK
    MS-Off Ver
    2010
    Posts
    2

    Re: Macro to select and copy entire rows containing text string

    My work internet seems to block the attachment page. I've gotten somewhere with the VBA but it's only partially there. I've got this:

    Sub MultiTestNew()
    Dim Rng As Range, Cell As Range

    Set Rng = Range(Range("AJ2"), Range("AJ" & Rows.Count).End(xlUp))

    For Each Cell In Rng

    If Cell = "1" Then
    Cell.EntireRow.Select
    End If

    Next Cell

    End Sub


    I've adapted it from somewhere else and it selects the correct rows I need but it selects them one at a time. I need it to select all rows where Column AJ = 1 and then copy them. Can you adapt the above VBA?

    Thanks

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to select and copy entire rows containing text string

    Maybe:

    Please Login or Register  to view this content.
    Copies to Sheet2.

+ 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. Macro seems to make entire text string in cells Bold
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-01-2014, 01:30 PM
  2. Search string in a column then copy entire rows to another sheet
    By vannylette in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2013, 12:16 PM
  3. [SOLVED] Search multiple worksheets for Text String, copy and paste entire row into new worksheet
    By spulliam2000 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-15-2013, 07:52 PM
  4. [SOLVED] Macro to Search column for Text string and Copy Entire Row to another Worksheet
    By TJacks1908 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2013, 07:11 AM
  5. [SOLVED] Copy and Paste Entire Row from Sheet1->Sheet2 based on text string match in Sheet1 Row
    By dmlovic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-17-2012, 08:42 AM
  6. Easy problem for you, select rows after finding text string, delete selection
    By yeoman12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-17-2009, 09:08 PM
  7. [SOLVED] Macro to select 4 entire rows and then delete rows
    By Scott Viney in forum Excel General
    Replies: 3
    Last Post: 09-22-2005, 03:05 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