Alex Rivera | Logout

VBA Stop calculation of cells

Asked 2013-06-06T12:54:54.767
8

Very new to VBA in Excel, got asked to do some validation on cell change and got a bit stuck.

So, user needs to enter a monetary value into a cell, let's say D16, so I thought I'd hook into the _Change event on the Worksheet which works quite well.

However, I need the rest of the worksheet to not complete the calculation when an entry has been submitted into D16, basically, when 500000 is entered, other cells gets updated with values from another worksheet.

My code

Private Sub Worksheet_Change(ByVal Target As Range)

    If Target = Range("D16") Then

       Dim numeric
       numeric = IsNumeric(Target)


       If numeric = False Then

          MsgBox "error"
          Exit Sub

          /// this is where I need to "stop" the calculations from firing

       End If

    End If

End Sub
Edit
Report

1 Answer

11

Use Application.Calculation = xlCalculationManual.

Don't forget to switch it back on again: Application.Calculation = xlCalculationAutomatic.

answered 2013-06-06T13:00:33.587

Your Answer