Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8490165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:02:21+00:00 2026-06-10T22:02:21+00:00

I want to amend the code below I want the findwhat to pick text

  • 0

I want to amend the code below

I want the findwhat to pick text from a range (“a1:20”)-which contains the list of text i want to look for

If it finds the text in the description in B, i want it to return the text it found e.g jo IN range c beside its description

Thanks

Option Explicit

Sub x()
    Dim FindWhat, rngCell As Range, i As Integer

    FindWhat = Array("Jo", "oa", "of", "koo")
    For i = 0 To 3
        For Each rngCell In Range("B2", Range("B" & Rows.Count).End(xlUp))
            If InStr(rngCell, FindWhat(i)) <> 0 Then
                rngCell.Offset(0, 1) = rngCell
                rngCell.Offset(, 1).Resize(, 2).Copy
            End If
        Next rngCell
    Next i

End Sub   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:02:23+00:00Added an answer on June 10, 2026 at 10:02 pm

    Try this:

    Option Explicit
    
    Sub x()
        Dim findRng As Range, _
            targetRng As Range, _
            findCell As Range, _
            found As Range
        Dim i As Integer
        Dim firstFound As String, _
            columnName As String
    
        columnName = "B"
        Set findRng = Range("A1:A20")
        For Each findCell In findRng
            Set targetRng = Range(columnName & "2", Range(columnName & Rows.Count).End(xlUp))
            With targetRng
                Set found = .Find(findCell.Value, LookIn:=xlValues, lookat:=xlPart)
                If Not found Is Nothing Then
                    firstFound = found.Address
                    Do
                        found.Offset(0, 1).Value = found.Offset(0, 1).Value & findCell.Value & ", "
                        Set found = .FindNext(found)
                    Loop While Not found Is Nothing And found.Address <> firstFound
                End If
            End With
        Next findCell
    
    End Sub
    

    Note that unless what you’re doing is a little more complex than this, you can achieve this result using cell formulae. Read the help on the Index, Match and VLookup functions to see how to achieve this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

See my code snippet below: var list = ['one', 'two', 'three', 'four']; var str
I have the following text: 3/1 I want to amend it to be: 3/1
I have a list of words that I want to exclude from some query
I have a map which contains integer values. i want to re-arange this map
Want to run javascript function from parent window in child window Example I have
Want to open firefox from terminal at linux with firebug enabled // Terminal $
want to have a Hyperlink-Button in a gridView in which I can display a
Want to code a key pad for an calculator. What I want to make
I have some JavaScript code and a button which already has an event/action assigned
I need to inherit from a base class, one method of which has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.