+ Reply to Thread
Results 1 to 1 of 1

during search the word which is found to copied/displayed to its next row(next Column)

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    during search the word which is found to copied/displayed to its next row(next Column)

    can i copy/paste the word which is found during search the word which is found to copied/display its next row(Column)

    using this code

    please help me

    Sub FindAndColor()
    
        Dim cell        As Variant
        Dim FndWhat     As String
        Dim RegExp      As Object
        Dim RngBeg      As Range
        Dim RngEnd      As Range
        Dim SearchWords As Variant
        Dim Word        As Variant
        
        
            Set RngBeg = Range("F2")
            Set RngEnd = Cells(Rows.Count, "F").End(xlUp)
            If RngEnd.Row < RngBeg.Row Then Exit Sub
            
            SearchWords = Range(RngBeg, RngEnd).Value
            
            Set RngBeg = Range("D2")
            Set RngEnd = Cells(Rows.Count, "D").End(xlUp)
            If RngEnd.Row < RngBeg.Row Then Exit Sub
            
             
            
            Set RegExp = CreateObject("VBScript.RegExp")
            RegExp.IgnoreCase = True
            
            Application.ScreenUpdating = False
            
                For Each Word In SearchWords
                    RegExp.Pattern = "\b" & Word & "\b"
                    For Each cell In Range(RngBeg, RngEnd)
                        If RegExp.Execute(cell).Count > 0 Then
                            cell.Interior.ColorIndex = 6
                            cell.Interior.Pattern = xlSolid
                        End If
                    Next cell
                Next Word
            
            Application.ScreenUpdating = True
            
    End Sub
    Attached Files Attached Files

+ 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. A word search to return words found in given fields
    By JonBrett in forum Excel General
    Replies: 2
    Last Post: 03-28-2014, 10:16 PM
  2. [SOLVED] Search within a column and repeat the search until all items are found
    By RANDY LIPOSKY in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-09-2014, 10:23 AM
  3. [SOLVED] Create a defined number of copied cells for values found in a column
    By S.Taylor in forum Excel Formulas & Functions
    Replies: 27
    Last Post: 11-08-2013, 04:25 AM
  4. Replies: 4
    Last Post: 05-07-2012, 10:53 PM
  5. How to search for a word in a column and have entire row opaque once word is found
    By copleyr in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-04-2009, 07:11 PM

Tags for this Thread

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