Thread: auto hide
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default auto hide

This is worksheet event code which runs whenever a calculation takes place.

Sheet names don't matter.

To place the code in one sheet just right-click on the sheet tab and "View
Code"

Paste the code into that sheet module.

If you want the code to run on every sheet in the workbook, change the first
line to

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

If using Excel 2003 or earlier............Right-click on the Excel Icon left
of "File" on the Menu Bar or left end of the title bar if window is not
maximized.

Select "View Code" and paste into Thisworkbook module.

If using Excel 2007, Alt + F11 to go to Visual Basic Editor.

Expand Excel Objects and double-click on Thisworkbook module. Paste into
that module.

For more on this and Event Code, see Ron de Bruin's site which has
instructions and links to other sites.

http://www.rondebruin.nl/code.htm


Gord





On Fri, 30 Jan 2009 22:17:01 -0800, Chad
wrote:



"Gord Dibben" wrote:

Private Sub Worksheet_Calculate()
'Hide rows with formulas that return negatives
Dim cell As Range
On Error GoTo endit
Application.EnableEvents = False
Application.ScreenUpdating = False
With Me.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



Ok I think this is the macro I need to run however I am just now learning
macros and when I copy and pasted of course it did not work for the fact you
do not have the names of the sheets in my file. Is there anyway I can get you
to repost this macro with each part I need to replace with file specific info
being follow by a set of (). For example if something on here needs the name
of a certain sheet follow it with like (sheet1) or something like that or
link me a site to teach me macros. /VR