View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Worksheet_Calculate or Worksheet_Change?

It is Calculate, and I would stop events

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
If Range("A4").Value Range("A5").Value And _
Range("A4").Value < Range("A6").Value Then
Worksheets("Sheet1").Columns("C:E").Hidden = True
End If
Application.EnableEvents = True
End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Aria Weston" wrote in message
...
Hello,
Should I use Worksheet_Calculate or Worksheet_Change in order to trigger
the code once the target cell is updated through formula?

If it's Worksheet_Calculate, how do you rewrite this (code doesn't
work)?

Private Sub Worksheet_Calculate()
Range("A4") 'is the only target cell
If date("A4") date("A5") and date("A4") < date("A6") then
worksheets("Sheet1").columns("C:E").entirecolumn.h idden = True
End If
End Sub

Do I need application.enableevents=False to start, then end it with
application.enableevents=True?

Thank-you so much,
Aria

*** Sent via Developersdex http://www.developersdex.com ***