PC Review


Reply
Thread Tools Rate Thread

Automatically Hiding Rows when certain cell value has been selecte

 
 
Jason
Guest
Posts: n/a
 
      17th Nov 2009
I am trying to hide rows 13-16 when a certain value has been selected from a
named range that contatins a drop down list.

Any help will be greatly appreciated.

Regards
--
Jason
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      17th Nov 2009
Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.

-Change the range and the text string to suit your requirement

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A13:A16")) Is Nothing Then
If Target.Count = 1 And Target.Text = "3" Then Rows(Target.Row).Hidden = True
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jason" wrote:

> I am trying to hide rows 13-16 when a certain value has been selected from a
> named range that contatins a drop down list.
>
> Any help will be greatly appreciated.
>
> Regards
> --
> Jason

 
Reply With Quote
 
Jason
Guest
Posts: n/a
 
      17th Nov 2009
Hi Jacob,

Thanks for coming back to me so quickly. However, this did not work.

The drop down list is in a range of cells named "LocationInput" (E4:J4), and
when the value of 11599 (DCM) is selected (this is in the drop down list). I
would like rows 13,14,15 & 16 to be hidden.

I have also named the 4 rows that are to be hidden as "RowsToHide".

There are only 3 values in the drop down list, so when one of the other
values is selcted, then the 4 rows should unhide.
--
Jason


"Jacob Skaria" wrote:

> Select the sheet tab which you want to work with. Right click the sheet tab
> and click on 'View Code'. This will launch VBE. Paste the below code to the
> right blank portion. Get back to to workbook and try out.
>
> -Change the range and the text string to suit your requirement
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Application.EnableEvents = False
> If Not Application.Intersect(Target, Range("A13:A16")) Is Nothing Then
> If Target.Count = 1 And Target.Text = "3" Then Rows(Target.Row).Hidden = True
> End If
> Application.EnableEvents = True
> End Sub
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Jason" wrote:
>
> > I am trying to hide rows 13-16 when a certain value has been selected from a
> > named range that contatins a drop down list.
> >
> > Any help will be greatly appreciated.
> >
> > Regards
> > --
> > Jason

 
Reply With Quote
 
Jason
Guest
Posts: n/a
 
      18th Nov 2009
Hi People, Can anyone help please!!

Cheers
--
Jason


"Jason" wrote:

> Hi Jacob,
>
> Thanks for coming back to me so quickly. However, this did not work.
>
> The drop down list is in a range of cells named "LocationInput" (E4:J4), and
> when the value of 11599 (DCM) is selected (this is in the drop down list). I
> would like rows 13,14,15 & 16 to be hidden.
>
> I have also named the 4 rows that are to be hidden as "RowsToHide".
>
> There are only 3 values in the drop down list, so when one of the other
> values is selcted, then the 4 rows should unhide.
> --
> Jason
>
>
> "Jacob Skaria" wrote:
>
> > Select the sheet tab which you want to work with. Right click the sheet tab
> > and click on 'View Code'. This will launch VBE. Paste the below code to the
> > right blank portion. Get back to to workbook and try out.
> >
> > -Change the range and the text string to suit your requirement
> >
> > Private Sub Worksheet_Change(ByVal Target As Range)
> > Application.EnableEvents = False
> > If Not Application.Intersect(Target, Range("A13:A16")) Is Nothing Then
> > If Target.Count = 1 And Target.Text = "3" Then Rows(Target.Row).Hidden = True
> > End If
> > Application.EnableEvents = True
> > End Sub
> >
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Jason" wrote:
> >
> > > I am trying to hide rows 13-16 when a certain value has been selected from a
> > > named range that contatins a drop down list.
> > >
> > > Any help will be greatly appreciated.
> > >
> > > Regards
> > > --
> > > Jason

 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      18th Nov 2009
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "Locationinput"
Dim cell As Range
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Application.EnableEvents = False
For Each cell In Target
With Target
If .Value = "11599 (DCM)" Then
Range("Rowstohide").EntireRow.Hidden = True
Else
Range("Rowstohide").EntireRow.Hidden = False
End If
End With
Next cell
End If
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Wed, 18 Nov 2009 01:02:04 -0800, Jason <(E-Mail Removed)>
wrote:

>Hi People, Can anyone help please!!
>
>Cheers


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding/Unhiding Rows Automatically Brad Resnick Microsoft Excel Worksheet Functions 1 23rd Feb 2010 11:29 PM
Automatically hiding rows with specific values =?Utf-8?B?RGFyaWE=?= Microsoft Excel Programming 3 18th Jan 2006 03:18 AM
Automatically Hiding Blank Rows patryan22@aol.com Microsoft Excel Misc 5 31st Dec 2005 04:13 PM
How do I stop an Excel sheet from automatically hiding rows when . =?Utf-8?B?a2F6eXJlZWQ=?= Microsoft Excel Worksheet Functions 1 3rd Feb 2005 03:35 PM
Hiding rows automatically based on the value in a cell Cathy Microsoft Excel Misc 2 6th Jan 2004 03:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:16 PM.