+ Reply to Thread
Results 1 to 6 of 6

Change Selected Cell Colour ...only whilst selected

  1. #1
    Registered User
    Join Date
    01-04-2013
    Location
    South Wales
    MS-Off Ver
    Excel 2010
    Posts
    6

    Question Change Selected Cell Colour ...only whilst selected

    Hi guys,

    I know about as much about VBA code as an ill-educated badger so could do with a few pointers here.

    I have a large table of figures that I work from (nothing out of the ordinary, just a load of numbers).
    I need to find a cell and use the values in another document.

    To make this easier I would like to select a cell and have the font and background colour to change so it highlights it so I don't lose where it was when I look away to my 2nd screen.

    I have found and adjusted a code from else where on 'tinternet but there's a problem...

    The code I found makes the font colour change to red and then goes back to black again when you move to another cell.
    This is great but I wanted to make it even more obvious by also temporarily changing the font to bold and changing the background colour to something else too.

    This code below does this, but it's still only the font colour that reverts back to its original state when you move to a different cell. The cell background colour and bold setting remains and doesn't revert back when you move on.
    I'm guessing its something to do with the ColorIndex = xlAutomatic part? is that right?
    Is there a similar setting for the bold and bg color settings?

    the code in question

    Please Login or Register  to view this content.
    Last edited by mrgrotey; 06-27-2017 at 04:40 AM.

  2. #2
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Change Selected Cell Colour ...only whilst selected

    Try this... I cant remember where I found it but I have been using it for some time now

    Please Login or Register  to view this content.
    Last edited by meabrams; 06-27-2017 at 06:15 AM.
    Bramz

  3. #3
    Registered User
    Join Date
    01-04-2013
    Location
    South Wales
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Change Selected Cell Colour ...only whilst selected

    Thanks for that. Its kinda works. The only thing that is not ideal is that it resets all bg colours to white first.
    I have an alternate-row colour scheme going on. Is there any way to adjust it so it keeps the original cell colours?

    Capture.PNG

  4. #4
    Registered User
    Join Date
    01-04-2013
    Location
    South Wales
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Change Selected Cell Colour ...only whilst selected

    the blue colour is r226 g239 b250
    so could it be something like if ^^^blue do 'this', if white do 'this'?

  5. #5
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Change Selected Cell Colour ...only whilst selected

    Well Here's a workaround that I came up with I'm sure there are better ways to accomplish this!

    In ThisWorkbook
    Please Login or Register  to view this content.
    In a Module
    Please Login or Register  to view this content.
    In The Sheet

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-04-2013
    Location
    South Wales
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Change Selected Cell Colour ...only whilst selected

    Wow that quite a bit over my head but I can use the file you attached and past the data into it.
    Thanks so much for taking the time to do this.

    Much appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 09-16-2013, 04:23 PM
  2. How to change the colour of tabs for sheets selected
    By jackstraw in forum Excel General
    Replies: 7
    Last Post: 09-12-2012, 10:44 AM
  3. Find Whilst Array Selected
    By timbo1957 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-18-2011, 05:03 AM
  4. changing colour of selected cell
    By samg27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-16-2008, 08:35 AM
  5. have a cell change colour when selected?
    By Farnarkler in forum Excel General
    Replies: 1
    Last Post: 03-04-2008, 12:43 PM
  6. [SOLVED] [SOLVED] How to change entire row colour when row is selected?
    By gregglazar@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-03-2006, 10:40 AM
  7. [SOLVED] [SOLVED] Change text colour of a cell when a different cell is selected
    By gregglazar@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2006, 03:30 AM
  8. change highlight colour of selected cells
    By Starskys Bird in forum Excel General
    Replies: 1
    Last Post: 04-29-2006, 09:30 AM

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