Cell Reference- Hiding Rows-Urgent

  • Thread starter Thread starter Supriya
  • Start date Start date
S

Supriya

I have 2 sheets where the 2nd sheet has 5 columns. All 5 columns mak
cell reference to first sheet(which has formulas).

Now i need to hide the rows in the 2nd sheet since it shows 0, unti
some calculation is made & the result is put up. The rows should pop u
only when it has the result value.Until then it should be hidden.

[The 0's are shown becoz it has cell reference to 1st sheet, whic
contains formulas
 
Try putting somthing like this in your "(Sheet2)" module
under MS Excel Objects:

Private Sub Worksheet_Calculate()

lastrow = Range("A1").CurrentRegion.Rows.Count

For a = 1 To lastrow
If Range("A" & a).Value = 0 Then
Range("A" & a).EntireRow.Hidden = True
Else
Range("A" & a).EntireRow.Hidden = False
End If
Next a

End Sub
 
Why not just format the cells so zero values are blank?

in the format window the format upto the first semi-colon
are positive, up to the 2nd are negative and after that
will format for zero values
example $#,##0.00_);[Red]($#,##0.00);$#,##0.00_ or to make
the 0 blank, don't put anything after the 2nd
$$#,##0.00_);[Red]($#,##0.00); (be sure to include the
semi-colon at the ent)
-----Original Message-----
Try putting somthing like this in your "(Sheet2)" module
under MS Excel Objects:

Private Sub Worksheet_Calculate()

lastrow = Range("A1").CurrentRegion.Rows.Count

For a = 1 To lastrow
If Range("A" & a).Value = 0 Then
Range("A" & a).EntireRow.Hidden = True
Else
Range("A" & a).EntireRow.Hidden = False
End If
Next a

End Sub



-----Original Message-----
I have 2 sheets where the 2nd sheet has 5 columns. All 5 columns make
cell reference to first sheet(which has formulas).

Now i need to hide the rows in the 2nd sheet since it shows 0, until
some calculation is made & the result is put up. The
rows
should pop up
only when it has the result value.Until then it should
be
hidden.

[The 0's are shown becoz it has cell reference to 1st sheet, which
contains formulas]
.
 
Back
Top