Results 1 to 9 of 9

Macro to Search(Find) specific word from list, and copy a cell referenced from each

Threaded View

DadaaP Macro to Search(Find)... 10-28-2013, 01:13 PM
DadaaP Re: Macro to Search(Find)... 10-28-2013, 03:15 PM
AB33 Re: Macro to Search(Find)... 10-28-2013, 04:41 PM
DadaaP Re: Macro to Search(Find)... 10-28-2013, 04:59 PM
AB33 Re: Macro to Search(Find)... 10-28-2013, 05:14 PM
DadaaP Re: Macro to Search(Find)... 10-28-2013, 05:46 PM
AB33 Re: Macro to Search(Find)... 10-28-2013, 05:57 PM
DadaaP Re: Macro to Search(Find)... 10-30-2013, 12:07 PM
DadaaP Re: Macro to Search(Find)... 11-04-2013, 02:34 PM
  1. #1
    Registered User
    Join Date
    05-30-2013
    Location
    US
    MS-Off Ver
    2013
    Posts
    67

    Macro to Search(Find) specific word from list, and copy a cell referenced from each

    Problem: I have a list in Sheet1 ("Main") in Column X that is dynamic in length every time I run the program. The list will be used as the search parameter for each search until the list has ended.
    I would like the program then to start with the first row in Sheet 1 Column X as the search term, ie: Morrison Maierle and then search Sheet 2 ("NoRetention") for the match throughout the sheet in column K, and each time it finds word I would like it to reference a cell that is 8 column away from it in column S.

    Keep doing this for every instance of the word and then total up the amounts in Column S.

    Solution: I have thought up so far a solution that does not work but I think is close to there. I have written it out to copy all cells into Column W. What I have not done is make it total up everything in Column Y and place that amount in the same row as the name it search Morrison Maierle in Column Y.

    Goal: When the program is done I have a neat list of column X companies, and column Y of total amounts it found in Sheet2("NoRetention") that were added up from Column W.

    Code so far:
    Sub SearchForReceivedAmt()
        Dim wsData As Worksheet
        Dim wsDest As Worksheet
        Dim rngFound As Range
        Dim strFind As String
        Dim strFirst As String
        Dim counter As Integer
        Dim pastecounter As Integer
        
        Set wsData = Sheets("NoRetention")
        Set wsDest = Sheets("Main")
        pastecounter = 1
        businesscounter = 1
        
        strFind = Sheet1.Cells(businesscounter, "X").Text
        
    wsDest.Cells(1, "X").Activate
    Do Until ActiveCell Is Nothing
            Set rngFound = wsData.Range("K:K").Find(What:=strFind, After:=ActiveCell, LookIn:=xlValues, Lookat:=xlPart)
            If Not rngFound Is Nothing Then
                ActiveCell.Offset(0, 8).Activate
                ActiveCell.Copy
                wsDest.Cells(pastecounter, "W").Paste
                wsData.Activate
                ActiveCell.Offset(0, -8).Activate
                pastecounter = pastecounter + 1
                businesscounter = businesscounter + 1
            Else
                Exit Sub
            End If
            Set rngFound = Nothing
            Loop
            wsDest.Activate
            ActiveCell.Offset(1, 0).Activate
            Loop
            
    Err_handle:         Exit Sub
            
    End Sub

    Also have attached a sample test book of the problem.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA Macro for search specific word and input specific value
    By Toton6868 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-10-2013, 07:14 AM
  2. Macro to search sheet for certain criteria and copy specific data to cell
    By ThaGonz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-02-2012, 12:34 PM
  3. Replies: 13
    Last Post: 08-04-2011, 09:41 AM
  4. Replies: 1
    Last Post: 01-25-2011, 10:50 PM
  5. search for a specific word and copy the word and the preceeding words until a comma
    By DHANANJAY in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-31-2005, 09: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