Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code for Find? (Excel 2000)

    Good Afternoon,

    Could someone tell me what the code is for "Find" and or "Find and Replace".

    Thanks.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Code for Find? (Excel 2000)

    Use the Find Method and the Replace Method

    Here is an example from the HELP for find
    This example finds all cells in the range A1:A500 that contain the value 2 and makes those cells gray.

    <pre>With Worksheets(1).Range("a1:a500")
    Set c = .Find(2, lookin:=xlValues)
    If Not c Is Nothing Then
    firstAddress = c.Address
    Do
    c.Interior.Pattern = xlPatternGray50
    Set c = .FindNextŠ
    Loop While Not c Is Nothing And c.Address <> firstAddress
    End If
    End With
    </pre>


    Here is an extract for replace:
    This example replaces every occurrence of the function SIN with the function COS. The replacement range is column A on Sheet1.

    <pre>Worksheets("Sheet1").Columns("A").Replace _
    What:="SIN", Replacement:="COS", _
    SearchOrder:=xlByColumns, MatchCase:=True
    </pre>


    Steve

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Mpls, Minnesota, USA
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code for Find? (Excel 2000)

    <P ID="edit" class=small>(Edited by WebGenii on 28-Feb-03 12:25. to add links. Linking to posts is easy, just put square brackets around the following: post#=yourpostnumber)</P>Roberta,

    You might find what you are looking for in <post#=227113>post 227113</post#>, or you might wish to check out the Flexfind Utility by Jan (<post#=229625>post 229625</post#>)

    Hope this helps,
    Chuck
    Chuck Reimer
    I'm from the Government and I'm here to help...

Posting Permissions

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