Results 1 to 7 of 7

Offset from multiple selected cells

Threaded View

  1. #1
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Offset from multiple selected cells

    Good day,

    Much to my surprise, I was able to locate a "find all" function (which I'm including below). I've been able to get it to work the way I hoped it would, but am stuck now...

    Once the function finds and selects the cells in question, I'd like to add a notation in the first available column for each row selected. Generally, I just use something like this to add notes to the first available column:

    Range("xfd"& activecell.row).End(xlToLeft).Offset(0, 1).Select
    But with this function, I can't seem to get anything to work. All I really need to do is offset 2 columns to the right of each selected cell and add some text like "FOUND"

    Here's the findall function which I found here: http://www.ozgrid.com/forum/showthre...t=27240&page=1

    Function Find_Range(Find_Item As Variant, Search_Range As Range, _
        Optional LookIn As Variant, Optional LookAt As Variant, _
        Optional MatchCase As Boolean) As Range
         
        Dim c As Range
        If IsMissing(LookIn) Then LookIn = xlValues 'xlFormulas
        If IsMissing(LookAt) Then LookAt = xlPart 'xlWhole
        If IsMissing(MatchCase) Then MatchCase = False
         
        With Search_Range
            Set c = .Find( _
            What:=Find_Item, _
            LookIn:=LookIn, _
            LookAt:=LookAt, _
            SearchOrder:=xlByRows, _
            SearchDirection:=xlNext, _
            MatchCase:=MatchCase, _
            SearchFormat:=False)
            If Not c Is Nothing Then
                Set Find_Range = c
                firstAddress = c.Address
                Do
                    Set Find_Range = Union(Find_Range, c)
                    Set c = .FindNext(c)
                Loop While Not c Is Nothing And c.Address <> firstAddress
            End If
        End With
         
    End Function
    Thanks for any help/pointers (and I promise, this will be my last post today )
    Last edited by JP Romano; 01-06-2011 at 04:48 PM. Reason: corrected mistake

Thread Information

Users Browsing this Thread

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

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