View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Programming Help

Nate,

Select a cell in the column of interest, then run the macro below.

HTH,
Bernie
MS Excel MVP

Sub HideZeroValueRows()
Dim c As Range ' The cell found with what you want
Dim d As Range ' All the cells found with what you want
Dim myFind As Double
Dim firstAddress As String


myFind = 0
With ActiveCell.EntireColumn

Set c = .Find(myFind, LookIn:=xlValues, lookAt:=xlWhole)

If Not c Is Nothing Then
Set d = c
firstAddress = c.Address
Else:
MsgBox "Not Found"
End
End If

Set c = .FindNext(c)
If Not c Is Nothing And c.Address < firstAddress Then
Do
Set d = Union(d, c)
Set c = .FindNext(c)
d.Select
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
'Hide the rows of all the found cells
d.EntireRow.Hidden = True
ActiveCell.Select

End Sub



"Nate" wrote in message
...
I didn't know you could program in Excel until I found
this today. I have a problem with a spreadsheet i'm trying
to make. Here's my problem.

Basically I have one spreadsheet which displays all my
information, and another spreadsheet(different tab) which
you input all your information. When you input information
into the 2nd spreadsheet, it transfers it into specific
fields onto the first one. My problem comes in on the 1st
spreadsheet. The 1st spreadsheet will always remain the
same. But the amount of information inputted into the 1st
spreadsheet is different everytime, and ranges from 5 - 20
things inputted. Right now I have set aside about 25
spaces on the 1st sheet, when the information is entered
into the 2nd sheet, it is then displayed on the 1st sheet,
but sometimes I have extra space on the first sheet cause
the information inputted is less than the amount of space
i've allocated for it. My question is this: is there any
way that I can have a program in excel that would hide a
row, if the value in a cell in that row equaled 0. If
anyone can help me with this it would be greatly
appreciated. Thanks