+ Reply to Thread
Results 1 to 15 of 15

Highlight Column When Cell Selected Without Removing the Sheets Other Background Colours

  1. #1
    Registered User
    Join Date
    03-11-2015
    Location
    London, Canada
    MS-Off Ver
    2013
    Posts
    24

    Highlight Column When Cell Selected Without Removing the Sheets Other Background Colours

    Hello

    I want to Highlight Column When Cell Selected Without Removing the Sheets Other Background Colours in the sheet.

    The code is am using is:

    Please Login or Register  to view this content.
    But it removed all my other background row colours, does anyone know how to stop that from happening?

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    Maybe remove the red?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-11-2015
    Location
    London, Canada
    MS-Off Ver
    2013
    Posts
    24

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    Just tried it John but unfortunately does not work. The green highlighted column will not disappear when a new column is selected if that line is removed.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    Check your conditional formatting. If you colors are obtained through conditional formatting then you can't manipulate the colors the way you are attempting, and that may be the cause of the problem.

  5. #5
    Registered User
    Join Date
    03-11-2015
    Location
    London, Canada
    MS-Off Ver
    2013
    Posts
    24

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    There is no conditional formatting on my excel sheet

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    Try this out:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  7. #7
    Registered User
    Join Date
    03-11-2015
    Location
    London, Canada
    MS-Off Ver
    2013
    Posts
    24

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    That works much better! But is there a way to have the original colour replaced once a different column is selected?

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    ? It should do that the way it is... I made a sheet yellow, and each time I selected another, the green went back to yellow, and the new one green.

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    You did copy the 2 lines above the sub also right? those are private variables to the sheet, that store the previous column and colour

  10. #10
    Registered User
    Join Date
    03-11-2015
    Location
    London, Canada
    MS-Off Ver
    2013
    Posts
    24

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    I did copy the whole thing, that is strange my sheet is definitely not returning back to the original color (yellow in your case)

  11. #11
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    I even tried making some yellow, others red, others white, and some no colour... the active column goes to green, and the others revert to original colour... can you maybe attach your workbook? No data needed for this... just the book with at least the sheet that has this code.

  12. #12
    Registered User
    Join Date
    03-11-2015
    Location
    London, Canada
    MS-Off Ver
    2013
    Posts
    24

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou


  13. #13
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    mackenzie,

    Now I see the problem... you have different colours in different rows... i had not realized that, so my code based the "old" colour stored in a variable on the cell that gets clicked. I'll have to give this some thought.... but I am not sure what you want is possible without storing a LOT of temporary data.

    Do you know how many rows will need to have this applied? What I mean is, is there a limited number of rows that will need to be reset to the "old" colour? Or will the number of rows grow over time?
    Last edited by Arkadi; 05-15-2015 at 08:49 AM.

  14. #14
    Registered User
    Join Date
    03-11-2015
    Location
    London, Canada
    MS-Off Ver
    2013
    Posts
    24

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    The number of rows should not increase, just the number of columns.

  15. #15
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight Column When Cell Selected Without Removing the Sheets Other Background Colou

    Ok, give this one a shot... I have also provided a workbook_beforesave macro, so that on saving it does not save with the column highlighted (I believe... leaving final testing to you). The only thing is.... to avoid saving with highlight, the variables that store the old column and colour need to be public variables, and you are not allowed to have public variables in events. So in a normal module, at the top, put:
    Please Login or Register  to view this content.
    Then in the sheet's code:
    Please Login or Register  to view this content.
    And then in "ThisWorkbook" :
    Please Login or Register  to view this content.

+ 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. [SOLVED] Background Cell Colours
    By KateMaz in forum Excel General
    Replies: 5
    Last Post: 01-07-2013, 10:48 AM
  2. Multiple Background Colours in a Single Cell
    By Aaron1978 in forum Excel General
    Replies: 6
    Last Post: 06-04-2007, 02:54 PM
  3. Replies: 1
    Last Post: 05-22-2006, 05:10 AM
  4. How to highlight row and column of the selected cell
    By Row_Column_Highlight in forum Excel General
    Replies: 2
    Last Post: 02-27-2005, 07:06 PM
  5. Printing background cell colours
    By Hustler24 in forum Excel General
    Replies: 1
    Last Post: 02-09-2005, 12:34 PM

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