![]() |
How to disable certain code segment?
Dear Excel Gurus,
In C, one can mask off certain code segment by using macros like; #ifndef DISABLE_XXX //Code to be disabled #endif How can I do the same thing for Excel VBA? Thank you in advance. |
How to disable certain code segment?
On Nov 24, 9:26 am, "Sing" wrote:
Dear Excel Gurus, In C, one can mask off certain code segment by using macros like; #ifndef DISABLE_XXX //Code to be disabled #endif How can I do the same thing for Excel VBA? Thank you in advance. If Condition = TRUE Then Exit Sub ' to terminate execution of the sub and return to the calling Sub End ' to terminate and close (almost) everything. See the VBA help for details. EndIF |
How to disable certain code segment?
You don't have the flexibility that you have with C, but you can use
conditional compilation. #Const EXEC_THIS_CODE = False Sub AAA() Debug.Print 1 #If EXEC_THIS_CODE Then Debug.Print 2 #End If Debug.Print 3 #If EXEC_THIS_CODE Then Debug.Print 4 #End If Debug.Print 5 End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Sing" wrote in message ... Dear Excel Gurus, In C, one can mask off certain code segment by using macros like; #ifndef DISABLE_XXX //Code to be disabled #endif How can I do the same thing for Excel VBA? Thank you in advance. |
How to disable certain code segment?
hi
see this site http://cpearson.com/excel/vbe.htm regards FSt1 "Sing" wrote: Dear Excel Gurus, In C, one can mask off certain code segment by using macros like; #ifndef DISABLE_XXX //Code to be disabled #endif How can I do the same thing for Excel VBA? Thank you in advance. |
All times are GMT +1. The time now is 04:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com