A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

show hide row if



 
 
Thread Tools Display Modes
  #1  
Old May 15th, 2009, 05:01 PM posted to microsoft.public.excel.misc
Wanna Learn
external usenet poster
 
Posts: 340
Default show hide row if

Hello Scenario - Form - when the form is opened F6 is Blank and is a
dropdown
Row 17 is not hidden
now if F6 says Distributor I want to hide Row 17 otherwise row 17 show not
be hidden
Below is my code- but it does not work
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address "$F$6" Then Exit Sub
If .Value = "Distributor " Then
Rows(17).Hidden = True
ElseIf .Value = "Customer" Then
Rows(17).Hidden = False
ElseIf .Value = " Office" Then
Rows(17).Hidden = False
ElseIf .Value = "Demo " Then
Rows(17).Hidden = False
End If
End With


End Sub
thanks in advance

  #2  
Old May 15th, 2009, 05:23 PM posted to microsoft.public.excel.misc
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default show hide row if

In your code there is a space after Distributor ("Distributor "). Remove the
space or TRIM() the value

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


"Wanna Learn" wrote:

Hello Scenario - Form - when the form is opened F6 is Blank and is a
dropdown
Row 17 is not hidden
now if F6 says Distributor I want to hide Row 17 otherwise row 17 show not
be hidden
Below is my code- but it does not work
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address "$F$6" Then Exit Sub
If .Value = "Distributor " Then
Rows(17).Hidden = True
ElseIf .Value = "Customer" Then
Rows(17).Hidden = False
ElseIf .Value = " Office" Then
Rows(17).Hidden = False
ElseIf .Value = "Demo " Then
Rows(17).Hidden = False
End If
End With


End Sub
thanks in advance

  #3  
Old May 15th, 2009, 06:08 PM posted to microsoft.public.excel.misc
Don Guillett
external usenet poster
 
Posts: 6,167
Default show hide row if

This should cover case and extraneous space problems

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address "$F$6" Then Exit Sub
Rows(17).Hidden = False
If LCase(Application.Trim(.Value)) = "distributor" Then
Rows(17).Hidden = True
End If
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Wanna Learn" wrote in message
...
Hello Scenario - Form - when the form is opened F6 is Blank and is a
dropdown
Row 17 is not hidden
now if F6 says Distributor I want to hide Row 17 otherwise row 17 show not
be hidden
Below is my code- but it does not work
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address "$F$6" Then Exit Sub
If .Value = "Distributor " Then
Rows(17).Hidden = True
ElseIf .Value = "Customer" Then
Rows(17).Hidden = False
ElseIf .Value = " Office" Then
Rows(17).Hidden = False
ElseIf .Value = "Demo " Then
Rows(17).Hidden = False
End If
End With


End Sub
thanks in advance


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:56 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.