Code works in worksheet_change but not in worksheet_calculate

landonh

New Member
Joined
Sep 28, 2010
Messages
10
I am getting there but here is my current situation.
The worksheet_change event will work with this abbreviated code.

Private Sub Worksheet_Change(ByVal target As Range)

'***************************************************
' Add next group here
' [Line B1] Send Excel e-mail and output the result.
Dim ZedE11
Dim commandE11

'only run this code if E11 has changed ()
Set rngUpdate = Application.Intersect(target, Range("E11"))
If Not rngUpdate Is Nothing Then
If Range("E11").Value > ("600") Then

I need for the code to happen in the calculated method due to a formula in recalculating the data.

The non-working edition is as follows and has some thing to due with the calculated event.

Private Sub Worksheet_Calculate(ByVal target As Range)

'***************************************************
' Add next group here
' [Line B1] Send Excel e-mail and output the result.
Dim ZedE11
Dim commandE11

'only run this code if E11 has changed ()
Set rngUpdate = Application.Intersect(target, Range("E11"))
If Not rngUpdate Is Nothing Then
If Range("E11").Value > ("505") Then


I get a compile error:
Procedure declaration does not match description of event or procedure having the same name

The code works in the worksheet_change but not in the worksheet_calculate

:rofl:
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
The Calculate event does not have a Target parameter. Perhaps

Code:
Private Sub Worksheet_Calculate()

'***************************************************
' Add next group here
' [Line B1] Send Excel e-mail and output the result.
Dim ZedE11
Dim commandE11

'only run this code if E11 has changed ()
If Range("E11").Value > ("505") Then
 
Upvote 0
Private Sub Worksheet_Calculate(ByVal target As Range)

' Add next group here
' [Line B1] Send Excel e-mail and output the result.
Dim ZedE11
Dim commandE11

'only run this code if E11 has changed ()

Set rngUpdate = Application.Intersect(target, Range("E11"))

If Not rngUpdate Is Nothing Then

If Range("E11").Value > ("505") Then


I get a compile error:
Procedure declaration does not match description of event or procedure having the same name
 
Upvote 0
The purpose of this code is to send an email when a cell value is updated and above some criteria.

I only need to to activate if a cell is updated or changes in value.

Or is that the incorrect thinking for calculated.

It works for change but now calculated.
 
Upvote 0
Try

Code:
Private Sub Worksheet_Calculate()

'***************************************************
' Add next group here
' [Line B1] Send Excel e-mail and output the result.
Dim ZedE11
Dim commandE11
Static OldVal

'only run this code if E11 has changed ()
If Range("E11").Value <> OldVal Then
    OldVal = Range("E11").Value
    If Range("E11").Value > "505" Then
        '
        'more code
        '
    End If
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top