+ Reply to Thread
Results 1 to 6 of 6

VBA: Find given words with start and end position

  1. #1
    Registered User
    Join Date
    12-16-2019
    Location
    London
    MS-Off Ver
    2010
    Posts
    4

    VBA: Find given words with start and end position

    VBA: Find given words in column A with start and end position.
    Sheet: input1 has Name in column A and their details in column B
    Sheet: input2 has Names and words.
    If Names and words found in sheet input1 then Sheet: input2 will look like Sheet: output
    Attached Files Attached Files
    Last edited by zion1; 12-16-2019 at 10:52 PM.

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: VBA: Find given words with start and end position

    Maybe :
    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  3. #3
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: VBA: Find given words with start and end position

    Solution by another method.
    HTML Code: 
    Best Regards,
    Maras.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Another way …


    The classic Excel Find way :

    PHP Code: 
    Sub Demo1()
            
    Dim Rg(1) As RangeVR&, A$, WP&
            
    Set Rg(0) = Sheets("Input1").UsedRange.Columns(2)
            
    Application.ScreenUpdating False
        With Sheets
    ("input2").UsedRange
               
    .Offset(11).ClearContents
                V 
    = .Columns(1).Value2
            
    For 2 To UBound(V)
                If 
    Not IsEmpty(V(R1)) Then
                       Set Rg
    (1) = Rg(0).Find(V(R1), , xlValuesxlPart)
                    If 
    Not Rg(1Is Nothing Then
                            A 
    Rg(1).Address
                        
    Do
                                
    Application.Match(Rg(1)(10), .Rows(1), 0)
                            If 
    IsNumeric(WThen
                                P 
    InStr(Rg(1), V(R1))
                               .
    Cells(RW).Value2 V(R1) & ", " "-" Len(V(R1))
                            
    End If
                               
    Set Rg(1) = Rg(0).FindNext(Rg(1))
                        
    Loop Until Rg(1).Address A
                    End 
    If
                
    End If
            
    Next
        End With
            Application
    .ScreenUpdating True
            Erase Rg
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: VBA: Find given words with start and end position

    No loop,
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-16-2019
    Location
    London
    MS-Off Ver
    2010
    Posts
    4

    Re: VBA: Find given words with start and end position

    If the search input is more than once in the line then it's giving only the first searched output.
    Can the above VBA code be modified and let me get the output in the "same cell/same search term with a comma"?

+ 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. Drop Down lists start position
    By rosiedog1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-25-2019, 12:15 PM
  2. [SOLVED] Return a Words position in a string
    By noboffinme in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 02-18-2017, 11:52 PM
  3. Replies: 4
    Last Post: 04-27-2012, 06:38 AM
  4. Start Up position of User Form
    By Shazz in forum Excel General
    Replies: 3
    Last Post: 03-07-2012, 12:54 PM
  5. Calculate PTO by Start Date and Position
    By aiko in forum Excel General
    Replies: 0
    Last Post: 10-04-2010, 11:13 AM
  6. resetting form to start position?
    By Woolmep in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-15-2007, 05:23 AM
  7. Position To Start At
    By Andrew in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2005, 06:05 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