ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Is there a do not call function? (https://www.excelbanter.com/excel-discussion-misc-queries/170842-there-do-not-call-function.html)

pokdbz

Is there a do not call function?
 
For some reason a function is calling this:
Worksheet_SelectionChange(ByVal Target As Range)

I don't want it to call this function. Is there a way to make it so it
doesn't call this function if there is a selection change?

Ron Coderre

Is there a do not call function?
 
In the Sheet Module containing the code:
Either
1) comment out that event code
or
2) delete it

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"pokdbz" wrote in message
...
For some reason a function is calling this:
Worksheet_SelectionChange(ByVal Target As Range)

I don't want it to call this function. Is there a way to make it so it
doesn't call this function if there is a selection change?




Chip Pearson

Is there a do not call function?
 
Excel will automatically call the Worksheet_SelectionChange procedure when
the selection is changed (e.g., by clicking on a cell) either manually or by
other code. You can prevent event procedures from running with the
Application.EnableEvents property.

Application.EnableEvents = False
'
' your code here
'
Application.EnableEvents = True

However, it is very rarely required that you Select anything when working
with VBA. Instead, you can reference a range directly. For example,

Instead of
Range("A10").Select
Selection.Font.Bold = True

Use
Range("A10").Font.Bold = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"pokdbz" wrote in message
...
For some reason a function is calling this:
Worksheet_SelectionChange(ByVal Target As Range)

I don't want it to call this function. Is there a way to make it so it
doesn't call this function if there is a selection change?




All times are GMT +1. The time now is 10:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com