+ Reply to Thread
Results 1 to 3 of 3

Hide column if cell colur is grey

  1. #1
    Forum Contributor
    Join Date
    06-13-2008
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    277

    Hide column if cell colur is grey

    Hi Guys,

    Hopefully this is quite a simple bit of VBA code...

    I have a sheet which contains data from column E to column BT.

    Row 1 contains the titles - I have conditionally formatted these to use fill color Grey (R-128, G-128, B-128) if they are not required.

    I need some VBA that will do the following.

    - Look at each cell on row 1 between column E and BT,

    - If the cell in row 1 is conditionally formatted with Grey Fill (R-128, G-128, B-128) then hide the column.

    That's it, I just can't figure out how to write it!

    Many thanks for any help

  2. #2
    Forum Contributor
    Join Date
    11-26-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    159

    Re: Hide column if cell colur is grey

    HI try this,
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-13-2008
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    277

    Re: Hide column if cell colur is grey

    Hi MMarks,

    Thank you for this,

    I tried the code but it did not work (I don't think it identifiesd the fill colour as greay since it was only set like that through conditional formatting)

    I managed to find a workaround using your code by creating a helper row which used the same formula as the conditional formatting to output "Grey" if it was a grey cell and this worked perfectly:

    Please Login or Register  to view this content.
    Thank you for your help! Wouldnt have been able to do it without you.

    F

+ 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