+ Reply to Thread
Results 1 to 3 of 3

Searching Based On Contents Of Changeable Cell

Hybrid View

  1. #1
    Registered User
    Join Date
    10-04-2006
    Posts
    2

    Searching Based On Contents Of Changeable Cell

    Hi - long story short - need to do a search based on the contents of a cell, but this cell wil change from minute to minute, so the result of that search will obviously differ each time.

    So far, the relevant line of macro/VBA code is only searching for what was in the cell at the initial time of recording the macro, for example:





    Cells.Find(What:="Allen", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
    xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
    , SearchFormat:=False).Activate
    Application.CutCopyMode = False





    ...searches for "Allen" each time, no matter what the contents of the cell which contained "Allen" initially, is now.

    Many thanks in advance!

  2. #2
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394
    All you can do is get the search event to start again when there is a change on the sheet. Put the code into

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    End Sub

    or

    Private Sub Worksheet_Change(ByVal Target As Range)

    End Sub

  3. #3
    Registered User
    Join Date
    10-04-2006
    Posts
    2
    Will try that, many thanks!!!

+ 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