Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 34
Default Hiding cells based on the value in another cell

Hi,

I am using Excel 2007. I have created a worksheet where I would like to be
able to "hide" a group of cells based on the value of another cell.

I can do what I want by inserting a shape (rectangle) and giving it a white
background and a white line color. As I have chosen not to show gridlines on
my worksheet, this rectangle effectively hides the cells that are behind it.

I can write code to control the visibility of this rectangle based on the
value in a particular cell. I imagine that there is a way I can get this
code to run anytime the value in this cell changes. I am pretty sure that I
can do what I want.....but...

I just wanted ask if there is a better way to do this sort of thing? If
anyone has any recommendations, I'd really appreciate it.

Thanks in advance,
Paul






--
Paul Kraemer
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 345
Default Hiding cells based on the value in another cell

From your description 'Conditional Formating' would seem to be a simple
solution.
i.e. when the condition in your cell meets the criteria automatically change
font colour to match that of the cell background (usually white) thus hiding
the content.
Come back with precise detail if you require further help.

"Paul Kraemer" wrote:

Hi,

I am using Excel 2007. I have created a worksheet where I would like to be
able to "hide" a group of cells based on the value of another cell.

I can do what I want by inserting a shape (rectangle) and giving it a white
background and a white line color. As I have chosen not to show gridlines on
my worksheet, this rectangle effectively hides the cells that are behind it.

I can write code to control the visibility of this rectangle based on the
value in a particular cell. I imagine that there is a way I can get this
code to run anytime the value in this cell changes. I am pretty sure that I
can do what I want.....but...

I just wanted ask if there is a better way to do this sort of thing? If
anyone has any recommendations, I'd really appreciate it.

Thanks in advance,
Paul






--
Paul Kraemer

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 34
Default Hiding cells based on the value in another cell

Hi Ron,

That sounds like a good idea, but my only problem is that in the cells I am
trying to hide, I used several different fill colors and several different
border styles. With conditional formatting, I think I would have to deal
with alot of differnent cells individually instead of being able to apply one
conditional format to all of them. I think my idea of hiding/unhiding a
white rectangle to cover/uncover the cells will be easier for me in this
case. It is good to have another option though in case I get stuck.

Thank you for your help,
Paul
--
Paul Kraemer


"Ron@Buy" wrote:

From your description 'Conditional Formating' would seem to be a simple
solution.
i.e. when the condition in your cell meets the criteria automatically change
font colour to match that of the cell background (usually white) thus hiding
the content.
Come back with precise detail if you require further help.

"Paul Kraemer" wrote:

Hi,

I am using Excel 2007. I have created a worksheet where I would like to be
able to "hide" a group of cells based on the value of another cell.

I can do what I want by inserting a shape (rectangle) and giving it a white
background and a white line color. As I have chosen not to show gridlines on
my worksheet, this rectangle effectively hides the cells that are behind it.

I can write code to control the visibility of this rectangle based on the
value in a particular cell. I imagine that there is a way I can get this
code to run anytime the value in this cell changes. I am pretty sure that I
can do what I want.....but...

I just wanted ask if there is a better way to do this sort of thing? If
anyone has any recommendations, I'd really appreciate it.

Thanks in advance,
Paul






--
Paul Kraemer

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Hiding cells based on the value in another cell

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo stoppit
Application.EnableEvents = False
If Target.Address = "$A$2" And Target.Value = "qwerty" Then

Shapes("Rectangle 1").Fill.Transparency = 1#
Else
Shapes("Rectangle 1").Fill.Transparency = 0#

End If
stoppit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP


On Mon, 8 Feb 2010 13:25:04 -0800, Paul Kraemer
wrote:

Hi,

I am using Excel 2007. I have created a worksheet where I would like to be
able to "hide" a group of cells based on the value of another cell.

I can do what I want by inserting a shape (rectangle) and giving it a white
background and a white line color. As I have chosen not to show gridlines on
my worksheet, this rectangle effectively hides the cells that are behind it.

I can write code to control the visibility of this rectangle based on the
value in a particular cell. I imagine that there is a way I can get this
code to run anytime the value in this cell changes. I am pretty sure that I
can do what I want.....but...

I just wanted ask if there is a better way to do this sort of thing? If
anyone has any recommendations, I'd really appreciate it.

Thanks in advance,
Paul


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding/Exposing Rows based on a cell value Tami Excel Worksheet Functions 10 July 11th 09 02:03 PM
Hiding rows based on a cell? OX_Gambit Excel Worksheet Functions 3 July 10th 09 03:05 AM
hiding or showing rows based on a cell value jordanpcpre Excel Discussion (Misc queries) 6 April 24th 08 04:14 PM
Hiding rows based value of cell within row Legion_c18 Excel Discussion (Misc queries) 0 February 22nd 08 06:01 AM
hiding rows based on cell contents Jason M Excel Discussion (Misc queries) 1 October 30th 06 04:30 PM


All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"