Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
x = Worksheets("Sheet1").Cells(4, 1).Value
y = Worksheets("Sheet1").Cells(5, 1).Value
z = Worksheets("Sheet1").Cells(6, 1).Value
If x < y And x < z Then
Columns("C:E").Select
Selection.EntireColumn.Hidden = True
End If
End Sub
Thee macro above will do what you want. Where you put it depends on which
event you want to trap.
"Aria Weston" wrote:
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 ***