I am trying to hide columns when the value in a row is greater than value in a specfic cell. I modified code that I found on the forum to achieve this but somehow just can get it to fire. As I change the value in the specified cell all columns remain visible. The code I modified is shown below and comes from the following post.
http://www.excelforum.com/excel-prog...ll-result.html
I am a bit of a newbie at this but can generally follow what's going on in the code... the Dummies book helped a bunch!
Thanks very much for your help!'Hides the a column when the value in row 6 (D6:Z6) is greater than value in cell B3 Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count < 1 Then Exit Sub If Union(Range("$D$6:$Z$6"), Target).Address = Range("$D$6:$Z$6").Address Then If Target.Value > Range("$B$3") Then Target.EntireColumn.Hidden = True End If End Sub
--MrV
try it
'Hides the a column when the value in row 6 (D6:Z6) is greater than value in cell B3 Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Union(Range("D6:Z6"), Target).Address = Range("D6:Z6").Address Then Target.EntireColumn.Hidden = Target.Value > Range("B3").Value End If End Sub
Thanks very much for the suggestion. Unfortunately, it still does not fire. I have attached a copy of the file for your reference.
Just to make sure I am understanding this correctly, the appropriate columns should disappear when I change the value in B3.
Your help is appreciated!
--MrV
2012 QTD Forecast Tracking.xlsm
Last edited by MrV; 01-17-2012 at 08:58 AM. Reason: adding attached file and tags
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks