Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.69 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Behaviour of Worksheet_Calculate event in Excel – stored events?
  2. Private Sub Worksheet_Calculate()
  3.     i = MsgBox("Value " & Me.Range("A1").Value, vbOKOnly)
  4. End Sub
  5.        
  6. Public Sub mySub()
  7.     Application.EnableEvents = False
  8.     ThisWorkbook.Worksheets(2).EnableCalculation = True
  9.     ThisWorkbook.Worksheets(2).EnableCalculation = False
  10.     Application.EnableEvents = True
  11. End Sub
  12.        
  13. Public Sub mySub()
  14.     Application.EnableEvents = False
  15.     Application.Calculation = xlCalculationManual
  16.     ThisWorkbook.Worksheets(2).EnableCalculation = True
  17.     ThisWorkbook.Worksheets(2).EnableCalculation = False
  18.     Application.Calculation = xlCalculationAutomatic
  19.     Application.EnableEvents = True
  20. End Sub