Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 367
Default Automatically Hiding Rows when certain cell value has been selecte

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Automatically Hiding Rows when certain cell value has been selecte

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 367
Default Automatically Hiding Rows when certain cell value has been sel

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 367
Default Automatically Hiding Rows when certain cell value has been sel

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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Automatically Hiding Rows when certain cell value has been sel

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
wrote:

Hi People, Can anyone help please!!

Cheers


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
How do I change contents of a cell based on drop down list selecte yateswdy Excel Worksheet Functions 2 October 21st 09 04:18 AM
Excel 07 fill in cells based on what is selecte in another cell jason2444 Excel Discussion (Misc queries) 1 March 5th 08 12:55 AM
AUtomatically hiding a row when a certain cell is blank kirbster1973 Excel Discussion (Misc queries) 6 January 21st 08 05:47 PM
Automatically Hiding Blank Rows [email protected] Excel Discussion (Misc queries) 5 December 31st 05 05:13 PM
How do I stop an Excel sheet from automatically hiding rows when . kazyreed Excel Worksheet Functions 1 February 3rd 05 04:35 PM


All times are GMT +1. The time now is 07:38 AM.

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"