+ Reply to Thread
Results 1 to 6 of 6

How Can I Highlight with Different Colors with Keyboard Shortcut

  1. #1
    Registered User
    Join Date
    02-15-2009
    Location
    Newbury Park, California
    MS-Off Ver
    Excel 2003
    Posts
    9

    How Can I Highlight with Different Colors with Keyboard Shortcut

    Hello,

    I am looking for a way to easily highlight a selected text with either green or pink without having to click on the highlighter icon, move the mouse over the desired color, and then click. I would like two keyboard shortcuts - one for pink and one for green.

    If someone can point me in the right direction or create a macro for me, I would be very grateful.

    Thanks

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: How Can I Highlight with Different Colors with Keyboard Shortcut

    Hi,

    you can easily create your own macros for that, using the Word Macro recorder.

    1. highlight a word or phrase
    2. Start the macro recorder (Tools - Macro - Record new macro)
    3. assign the macro a name, define if it should be stored in Normal.dot or the current file, assign a keyboard shortcut (after all this, you'll close the dialogs and end up with a recording icon)
    4. format your selected text
    5. Stop the macro recorder

    Now you have a macro that formats selected text upon pressing the keys you specified.



    hth

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How Can I Highlight with Different Colors with Keyboard Shortcut

    In the alternative, you can click the Fill button, and tear off the Fill Color palette to float on the worksheet. Then you can select any color with a single mouse click.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    02-15-2009
    Location
    Newbury Park, California
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: How Can I Highlight with Different Colors with Keyboard Shortcut

    The macro solution worked great!

    However, because I'm a bit picky, I want a different shade of green and pink...

    Right now, the macro's code is here:

    Please Login or Register  to view this content.
    How can I replace wdPink with hex or some other method in order to specify a color to a great specificity?

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: How Can I Highlight with Different Colors with Keyboard Shortcut

    Hi,

    with the highlight you are restricted to the colors you see in the palette (and white).

    If you want a larger palette, you could use the background color of the text instead of the highlight functionality. This would open up all the colors in the palette. Something like

    Please Login or Register  to view this content.
    You will not be able to undo the color with the Highlight button, though, you'll either have to record another macro to set the background color back to nothing or go through the Format - Borders and Shading dialog.

    The named colors can be found in the Visual basic editor help, just enter "BackgroundPatternColor Property" as the help term and drill down do the wdColor list.

    Or, instead of the color name, you can use the RGB() function as in

    Please Login or Register  to view this content.
    hth

  6. #6
    Registered User
    Join Date
    07-13-2010
    Location
    St. Louis, MO USA
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: How Can I Highlight with Different Colors with Keyboard Shortcut

    I know this is an old thread but try this for your macro. It toggles between black, blue, and red.
    Sub Color_rows()
    '
    ' Color_rows Macro
    ' Toggle between blue/red/black
    '

    Select Case Selection.Font.ColorIndex
    Case xlColorIndexAutomatic
    Selection.Font.ColorIndex = 5
    Case 5
    Selection.Font.ColorIndex = 3
    Case Else
    Selection.Font.ColorIndex = xlColorIndexAutomatic
    End Select
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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