Thread: auto hide
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
akm akm is offline
external usenet poster
 
Posts: 19
Default auto hide

Gord
While doing search for help, found this post which is basically the question
we have and wonder if you might be able to help.
Understand (from a previous post in this newsgroup) it is not possible to
write a formula to hide a row when a cell in that row has a certain value,
like the word 'Done'.
But, am not sure how your code is supposed to be used/modified (after
pasting in the code interface page) in order to make that happen with code.
Not that familiar with Excel 'code'.
Checked out the link... http://www.rondebruin.nl/code.htm
....but didnt find much help.
Could you provide a specific example* of the code (and related formula ?)
for the example* above ?
*Hide row when cell in row has the word text 'Done' (no quotes) typed in...
and is it possible to then 'un-hide' the cell with the normal right-click
command ?
--
Thanks again for your help.
OS: XP, SP-2 (Office2003)



"Gord Dibben" wrote:

Where are you placing the code?

Worksheet only............original code should work fine.

If you placed it in Thisworkbook module, I screwed up a couple of
things.............apologies.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

should have been

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)

And we can't use Me.UsedRange in Thisworkbook since Me refers to
ActiveSheet.

Here is revised code to go into Thisworkbook module

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
'Hide rows with formulas that return negatives
Dim cell As Range
On Error GoTo endit
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
For Each cell In .Columns(1).SpecialCells(xlCellTypeFormulas)
If cell.Value < 0 Then cell.EntireRow.Hidden = True
Next cell
End With
endit:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub


Gord

On Sat, 31 Jan 2009 08:56:01 -0800, Chad
wrote:

When I follow those steps it keeps giving me errors after the with me part.
(.UsedRange
.Rows.Hidden = False)

That is the exact part it is having issue with.
Any ideas again thanks for your help