Results 1 to 3 of 3

Thread: VBA Find

  1. #1
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    VBA Find

    I'm new at VBA and don't understand what I'm doing (generally) with these lines to generate "Error 91 Object variable or With block variable not set". My purpose is to mess with only cells within the selection that contain an =INDIRECT formula:

    For Each c In Selection
    If c.Find("=INDIRECT", , LookIn:=xlFormulas, LookAt:=xlPart) Then
    <do stuff>
    End If ' contains =INDIRECT formula
    Next ' Selection
    -John ... I float in liquid gardens
    UTC -7ąDS

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Find

    I haven't tested the code below, so I hope there are no error in it. I think something like this will do what you want to do:

    <pre>Dim oC As Range
    For Each oC In Selection
    If Instr( oC.Formula, "=INDIRECT" ) > 0 then
    <do stuff>
    End If
    Next oC
    </pre>

    Legare Coleman

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: VBA Find

    Thank you, this works. <img src=/S/ribbon.gif border=0 alt=ribbon width=15 height=15> <img src=/S/groovin.gif border=0 alt=groovin width=21 height=21>
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •