1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Change format of a word in an Excel cell

Discussion in 'Business Applications' started by pskelly99, May 28, 2009.

Thread Status:
Not open for further replies.
Advertisement
  1. pskelly99

    pskelly99 Thread Starter

    Joined:
    May 28, 2009
    Messages:
    2
    I am trying to create a macro that will allow me to change the font of a word in Excel. I am able to change the entire cell, but would only like the word that I am searching on to change, not the entire cell.

    I have attached a file with the macro that I use now to highlight the entire cell, but would like to change it. This file does not contain the data that I normally look at on a daily basis (usually 8,000 to 60,000 lines of data and more data in each cell). In this file, I would like to change the format of the word "door".

    Any help would be greatly appreciated

    Pkelly99

    Copy of Macro:

    Sub Key_Word_Search()
    '
    ' Key_Word_Search Macro
    ' Keyboard Shortcut: Ctrl+q
    '
    InputMsg = "What key word would you like to find?"
    InputTitle = "Key word"
    DefaultText = "Enter key word"
    KeyWord = InputBox(InputMsg, InputTitle, DefaultText)

    Cells.Replace What:="door", Replacement:="door", LookAt:=xlPart, _
    SearchOrder:=xlByColumns, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=True

    End Sub
     

    Attached Files:

  2. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
  3. pskelly99

    pskelly99 Thread Starter

    Joined:
    May 28, 2009
    Messages:
    2
    This is close to what I am looking for, but I need it to search every cell in a column of data to search for the word. I do not want to have to run this macro 30,000 times in one spreadsheet.

    I am new to VBA programing and I am trying different things to try and make this work, but am not having much luck.
     
  4. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
    I don't know much VBA, but I would think that this
    Start = InStr(Start + 1, TargetCell.Text, TargetWord)
    If Start < 1 Then Exit Sub
    could be changed to If Start < 500 (pick your number) and it would continue.
    Or, you could insert a For/Next procedure so that it continued until nothing met the data it was to look for.
     
  5. jimr381

    jimr381

    Joined:
    Jul 20, 2007
    Messages:
    4,189
    First Name:
    Jim
    You might want to have it look through the whole active selection. This should alleviate you looking through the whole worksheet and instead have it look within your table/list.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/830701

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice