#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Hidden Row

I am working on an excel document where when a specific cell says no a row
will hide. This is the code I am using:
Private Sub Worksheet_Calculate()
If Worksheets("Interview").Range("A28").Value = "No" Then
Worksheets("Interview").Range("E29").EntireRow.Hid den = True
If Worksheets("Interview").Range("A28").Value = "Yes" Then
Worksheets("Interview").Range("E29").EntireRow.Hid den = False

End Sub

It will run fine when I place a no in the cell and go to the visual basic
and hit play, but I want it to run automatically. I wan the row to hide once
the cell says no, so you don't have to go to the visual basic editor and hit
play. Any suggestions?

thank you,

Dan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Hidden Row

Try this

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$A$28" Then
With Target
If .Value = "No" Then
Me.Range("E29").EntireRow.Hidden = True
ElseIf .Value = "Yes" Then
Me.Range("E29").EntireRow.Hidden = False
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--
HTH

Bob Phillips

"Daniel R. Young" wrote in message
...
I am working on an excel document where when a specific cell says no a row
will hide. This is the code I am using:
Private Sub Worksheet_Calculate()
If Worksheets("Interview").Range("A28").Value = "No" Then
Worksheets("Interview").Range("E29").EntireRow.Hid den = True
If Worksheets("Interview").Range("A28").Value = "Yes" Then
Worksheets("Interview").Range("E29").EntireRow.Hid den = False

End Sub

It will run fine when I place a no in the cell and go to the visual basic
and hit play, but I want it to run automatically. I wan the row to hide

once
the cell says no, so you don't have to go to the visual basic editor and

hit
play. Any suggestions?

thank you,

Dan



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
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Excel Discussion (Misc queries) 3 April 2nd 09 11:40 PM
Hidden Columns No Longer Hidden after Copying Worksheet? EV Nelson Excel Discussion (Misc queries) 1 December 6th 06 05:10 PM
How do I detect hidden worksheets or hidden data on a worksheet? Alice Excel Discussion (Misc queries) 4 August 24th 06 03:38 AM
I need my Hidden Rows to stay hidden when I print the sheet. Rosaliewoo Excel Discussion (Misc queries) 2 July 20th 06 07:51 PM
Saving hidden data with a worksheet (preferably without using a hidden sheet) Dick Kusleika[_3_] Excel Programming 2 January 21st 04 04:39 PM


All times are GMT +1. The time now is 01:50 AM.

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

About Us

"It's about Microsoft Excel"