Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Muaz Bashara   on Nov 22 In MS Office Category.

  
Question Answered By: Mona Wagner   on Nov 22


I assume cell  B4 on Sheet2 has a formula, so its value may change automatically
based on other cells, the time, etc. Paste the following event logic in the code
module for Sheet2:

Private Sub Worksheet_Calculate()
If Me.Range("B4") < 5 Then Me.Visible = False
If Me.Range("B4") >= 5 Then Me.Visible = True
End Sub

This code will run whenever Sheet2 is recalculated. To ensure that B4 always
get recalculated, you can add +(0*Now()) to the end of the formula in B4. It
won't change the value of B4, but the Now() function guarantees that excel  will
recalc B4 when the workbook is recalculated.

If you're new to macros, you may want to read David McRitchie's intro at:
www.mvps.org/dmcritchie/excel/getstarted.htm

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on unhide a page if a cell b4 equals 5 in excel Or get search suggestion and latest updates.


Tagged: