Double click - doesn not trigger macro

Wolf1978

New Member
Joined
Apr 17, 2013
Messages
4
Hi All,

I had simple Macro (open form) which was triggered when double click any cell, and all worked fine until today and I dont know what really happened.

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Admin.Show
End Sub

Now, when I double click cell, it goeas to edit mode, can not trigger macro at all. I dont really know waht happened, what settings I do need to check?

Many thanks for any tips.

Wilk
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You may have set EnableEvents to false without realising. While in the Visual Basic Editor, press Ctrl+G to display the Immediate Window, and then type Application.EnableEvents = True​ (and press Enter).
 
Upvote 0
Thanks Neil,

It works now. How could this change without my knowledge? Is there any way to avoid this kind of changes?

Thanks,
Wilk
 
Upvote 0
Thanks Neil,

It works now. How could this change without my knowledge? Is there any way to avoid this kind of changes?

Thanks,
Wilk


Most event code (e.g Worksheet_Change) will disable events, run the code and then re-enable events. If the code is prematurely stopped (or crashes), events won't be re-enabled. You can check the status by typing ?Application.EnableEvents​ in the Immediate window.
 
Upvote 0
Hi Neil,

Ther problem keep occuring when I run this macro below. ( user is selecting value from drop down list, if select At Standard, next 3 cells in that row will get AS value) Errors occurs when you delete values from entire row (it is hadled by Error handler) so user doen't see that, but you can not trigger macro after that while any changes are made, or double click. I need to close excel and open it again what is not ideal as you can imagin ;)

I think best solution it will be hadle situation when changes are made in Cloumn E and any other at the same time (this is happening when delating values from same row(s)) - but not sure how to handle that

Many thanks for your help.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error GoTo ErrorHandler
If Intersect(Target, Columns("E")) Is Nothing Then ' check if changes are in column E only
Exit Sub
Else ' if answer is Yes, check if it has value At Standard
If ActiveCell.Value = "At Standard" Then ' if it's at standard, All 3 other cells has value AS
ActiveCell.Offset(0, 1).Value = "AS"
ActiveCell.Offset(0, 2).Value = "AS"
ActiveCell.Offset(0, 3).Value = "AS"
ElseIf ActiveCell.Value = "" Then ' if it is emoty, it clear all oter 3 cells
ActiveCell.Offset(0, 1).Value = ""
ActiveCell.Offset(0, 2).Value = ""
ActiveCell.Offset(0, 3).Value = ""
End If
End If
ErrorHandler:
Application.EnableEvents = True
End Sub
 
Upvote 0
The issue is that you have a SheetChange event that changes cells on the sheet, which means it fires a SheetChange event, which changes cells on the sheet, etc.

The usual way to resolve this is as follows:
Code:
[COLOR=#333333]Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
With Application
.EnableEvents = False
.ScreenUpdating = False
End With

'your code here

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

End Sub[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,213,549
Messages
6,114,264
Members
448,558
Latest member
aivin

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