Workbook_SheetCalculate twice

S

Stefi

Hi All,

This event macro works well, but is executed twice:

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
Worksheets("Jelentés").CommandButton1.Enabled = _
Names("megvane").RefersToRange.Item(1, 1) And _
Names("megvane").RefersToRange.Item(1, 2) And _
Names("megvane").RefersToRange.Item(2, 1) And _
Names("megvane").RefersToRange.Item(2, 2)
Worksheets("Jelentés").CommandButton3.Enabled = _
Names("megvane").RefersToRange.Item(2, 3)
Worksheets("Jelentés").CommandButton2.Enabled = _
Names("megvane").RefersToRange.Item(3, 1) And _
Names("megvane").RefersToRange.Item(3, 2)
Worksheets("Jelentés").CommandButton4.Enabled = _
Names("megvane").RefersToRange.Item(3, 3)
End Sub

Why? If I insert Application.EnableEvents = False at the beginning of the
macro then it's executed only once, but I cannot find the place to switch it
back to True. If I insert Application.EnableEvents = True as the last line
then it's executed again twice.
How can I achieve only one executing?

Thanks,
Stefi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top