Results 1 to 2 of 2

macro to locate locate text string and copy/paste offset range

Threaded View

  1. #1
    Registered User
    Join Date
    12-16-2014
    Location
    Colorado, United States
    MS-Off Ver
    windows 7
    Posts
    1

    macro to locate locate text string and copy/paste offset range

    Hello - fairly new to VBA code. I have a macro that opens multiple PDF files, converts to excel, and merges into one excel file. i then need to search for a particular text string, copy the entire row containing that string, plus the 11 rows below it, and paste into a new worksheet. I need to perform this task until I've captured all instances of the text string. The problem is that the text string does not always appear in the same column and is not a set number of rows from the last instance. I have the simple code to find the first instance, but struggling to loop through the remaining cells. i tried to use "findnext" but can't figure out the syntax. Can someone help? thanks

    ActiveWorkbook.Worksheets("sheet1").Cells.Find(What:="PL Stg 1-2", after:=ActiveCell, LookIn:=xlFormulas, LookAt _
            :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Activate
            Rows(ActiveCell.Row).Select
            ActiveCell.Resize(12, 256).Select
            Selection.Copy
            Worksheets("sheet2").Activate
            ActiveCell.Offset(12, 0).Activate
            ActiveSheet.Paste
    Last edited by alansidman; 12-16-2014 at 08:45 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy Values to separate sheet, locate value in list and paste 6 cells to the left
    By drknot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2014, 10:16 AM
  2. Using macro to locate certain text, then copy the cell below text into another sheet
    By BobertSama in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2013, 01:32 PM
  3. [SOLVED] Macro: Locate specific text within supplied range
    By darrenkaye in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-17-2012, 01:03 PM
  4. Macro to locate/modify text
    By Nate in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2006, 01:55 PM
  5. [SOLVED] Locate and count the recurrences of a text string
    By Trish2 in forum Excel General
    Replies: 1
    Last Post: 03-08-2006, 11:10 AM

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