+ Reply to Thread
Results 1 to 3 of 3

search by keyword

  1. #1
    Registered User
    Join Date
    09-27-2005
    Posts
    3

    search by keyword

    Hello and "Happy Days off for Celebrating Something...or not".

    I was trying to make a macro that would allow me to type a word in A1, and touch an object to do a keyword search based on A1.

    Can I do that?


    Thanks all!!

    SJ.

  2. #2
    Norman Jones
    Guest

    Re: search by keyword

    Hi Subliminal,

    Try assigning the following code to a button::

    '=============>>
    Public Sub Tester001()
    Dim rng As Range
    Dim rngFound As Range
    Dim sStr As String

    Set rng = Range("A1")
    sStr = rng.Value

    Set rngFound = Cells.Find(What:=sStr, _
    After:=Selection, _
    LookIn:=xlValues, _
    LookAt:=xlPart, _
    SearchOrder:=xlByColumns, _
    SearchDirection:=xlNext)

    If rngFound.Address = rng.Address Then
    Set rngFound = Cells.FindNext(rngFound)
    End If

    rngFound.Activate

    End Sub
    '<<=============

    If you were unsure of the required syntax, you would find the macro recorder
    an invaluable tool.


    ---
    Regards,
    Norman


    "SubliminalJones"
    <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello and "Happy Days off for Celebrating Something...or not".
    >
    > I was trying to make a macro that would allow me to type a word in A1,
    > and touch an object to do a keyword search based on A1.
    >
    > Can I do that?
    >
    >
    > Thanks all!!
    >
    > SJ.
    >
    >
    > --
    > SubliminalJones
    > ------------------------------------------------------------------------
    > SubliminalJones's Profile:
    > http://www.excelforum.com/member.php...o&userid=27597
    > View this thread: http://www.excelforum.com/showthread...hreadid=496293
    >




  3. #3
    Registered User
    Join Date
    09-27-2005
    Posts
    3

    search function

    Hi Norman,

    Thanks for the help. It works good but it gives an error message that highlights

    Set rngFound = Cells.Find(What:=sStr, _
    After:=Selection, _
    LookIn:=xlValues, _
    LookAt:=xlPart, _
    SearchOrder:=xlByColumns, _
    SearchDirection:=xlNext)

    in the debugger. It appears to have a problem with

    SearchDirection:=xlNext)

    Any suggestions?

    Thanks again, SJ

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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