Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Chicago, Illinois, USA
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find text/change format of text/cell (Excel 2000)

    Afternoon all.

    I'm not familiar with code/macros in Excel at all, so I figured I'd come here! I'm looking for a bit of guidance/code...I need to search a fairly substantial spreadsheet/workbook for all instances of, say, the name "smith", and then make a formatting change to each of those cells (perhaps change the cell background to yellow) or to just the text, if that's easier (perhaps make the word 'smith' red).

    If anyone has any thoughts, I'd be very grateful; thanks in advance.

    klyjen

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Chicago, Illinois, USA
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find text/change format of text/cell (Excel 2000)

    Well, never mind; I figured it out. Here is the code I used, if anyone is curious...and in case anyone does a search for something similar....

    Sub FindFormat()
    Dim SearchText As String
    ' written to test finding text and changing its background

    SearchText = InputBox("Please type the search text.")
    Do While Not ActiveCell.Interior.ColorIndex = 6
    Cells.find(what:=SearchText, _
    after:=ActiveCell, searchorder:=xlByRows, _
    searchdirection:=xlNext, _
    MatchCase:=False).Activate
    If Selection.Interior.ColorIndex = 6 Then
    'do nothing
    Else
    With Selection.Interior
    .ColorIndex = 6
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    End With
    ActiveCell.Range("b1").Select
    End If
    Loop
    End Sub

    I think it's probably very messy, but it achieves the desired result...the user specifies the text she's looking for, and this runs through the sheet and highlights (in yellow) every cell that has string of text.

    klyjen

Posting Permissions

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