+ Reply to Thread
Results 1 to 5 of 5

Custom Keyboard Shortcut to COLOR FILL Highlighted Cells?

  1. #1
    Registered User
    Join Date
    03-01-2010
    Location
    San Diego
    MS-Off Ver
    Excel 2007
    Posts
    27

    Custom Keyboard Shortcut to COLOR FILL Highlighted Cells?

    I copy/paste a good enough information and i like to seperate these automated information into different colored rows using keyboard shortcuts. I can't use Conditional Formatting, because i have to investigate each piece of information before I color it a certain color.


    For example: Color Purple, Green, And Red


    Press Ctrl+1 = Color Purple
    Press Ctrl+2 = Color Green
    Press Ctrl+3 = Color Red

    Is this possible?

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Custom Keyboard Shortcut to COLOR FILL Highlighted Cells?

    Keyboard shortcuts must be letters, they cannot be numbers. But other than that, yeah, it's possible.

    Press Alt+F11 to open the Visual Basic Editor (VBE)
    Insert -> Module
    Type the following code:
    Please Login or Register  to view this content.
    Then go back to Excel (just re-activate it from your taskbar), and go to View -> Macros -> View Macros
    Click on the macro you just created (we named it HighlightPurple) and click Options
    There you can specify a keyboard shortcut

    Wash/Rinse/Repeat for other colors (be sure to change the name of the macro by adjusting the Sub ...() line)
    Here are the recognized colors you can use:
    vbBlack
    vbRed
    vbGreen
    vbYellow
    vbBlue
    vbMagenta
    vbCyan
    vbWhite
    xlNone
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    03-01-2010
    Location
    San Diego
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Custom Keyboard Shortcut to COLOR FILL Highlighted Cells?

    Quote Originally Posted by tigeravatar View Post
    Keyboard shortcuts must be letters, they cannot be numbers. But other than that, yeah, it's possible.

    Press Alt+F11 to open the Visual Basic Editor (VBE)
    Insert -> Module
    Type the following code:
    Please Login or Register  to view this content.
    Then go back to Excel (just re-activate it from your taskbar), and go to View -> Macros -> View Macros
    Click on the macro you just created (we named it HighlightPurple) and click Options
    There you can specify a keyboard shortcut

    Wash/Rinse/Repeat for other colors (be sure to change the name of the macro by adjusting the Sub ...() line)
    Here are the recognized colors you can use:
    vbBlack
    vbRed
    vbGreen
    vbYellow
    vbBlue
    vbMagenta
    vbCyan
    vbWhite
    xlNone
    Thank you so much for this! You saved me a lot of time. How do i make this effective for every Excel workbook i open? How can i easily apply it to all my past files? Thanks

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Custom Keyboard Shortcut to COLOR FILL Highlighted Cells?

    You'd have to open a blank workbook, put in the module, and save it as an addin.
    See here for more information: http://www.ozgrid.com/VBA/excel-add-in-create.htm

    Now I'm not 100% certain that you can use keyboard shortcuts to trigger a macro within an add-in (because I've never personally tried), but it can probably be done.

  5. #5
    Valued Forum Contributor
    Join Date
    09-25-2011
    Location
    Eastbourne, England
    MS-Off Ver
    Excel 2010
    Posts
    1,089

    Re: Custom Keyboard Shortcut to COLOR FILL Highlighted Cells?

    Hi yakabod

    Another way is to record the macros in a personal work book (which you can then hide). The personal workbook will automatically open every time you use Excel, so the macros will then be available.

    Regards
    Alastair

+ 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