ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Diabling Target Workboon Macos (if necessary) (https://www.excelbanter.com/excel-programming/352048-diabling-target-workboon-macos-if-necessary.html)

ExcelMonkey

Diabling Target Workboon Macos (if necessary)
 
I have a macro which searches cells of a target workbook:

For Each Cell In sh.UsedRange
'Do something
Next Cell

If this search occurs on a target workbook which has macros in the sheet
being searched (i.e. Workbook_SheetSelectionChange events or events triggered
by selecting cells), will this affect the routine? I gues I am not sure if
the routine triggers any of these events. As its a collection, I have been
assuming that this should not matter.

If it does, what can I do to avoid this from happening? Am I forced to
manually comment out code in target file? I am assuming that I cannot
disable macros as my search is also based on a macro.

Thanks

EM

Peter Rooney

Diabling Target Workboon Macos (if necessary)
 
Hi, ExcelMonkey,
You can use application.enableevents=true/false
This will suppress the execution of event macros and restart it as required.
Cheers

Pete


"ExcelMonkey" wrote:

I have a macro which searches cells of a target workbook:

For Each Cell In sh.UsedRange
'Do something
Next Cell

If this search occurs on a target workbook which has macros in the sheet
being searched (i.e. Workbook_SheetSelectionChange events or events triggered
by selecting cells), will this affect the routine? I gues I am not sure if
the routine triggers any of these events. As its a collection, I have been
assuming that this should not matter.

If it does, what can I do to avoid this from happening? Am I forced to
manually comment out code in target file? I am assuming that I cannot
disable macros as my search is also based on a macro.

Thanks

EM



All times are GMT +1. The time now is 12:02 AM.

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