Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Segment and count birthdays Michael Excel Discussion (Misc queries) 2 October 7th 09 02:53 PM
Each client to be identified into segment Mat Excel Discussion (Misc queries) 2 March 15th 07 03:59 PM
How to add trendline over multiple series and a segment of x-value progprog Charts and Charting in Excel 1 November 6th 06 06:21 PM
How to delete a line segment? Tom Hayakawa Charts and Charting in Excel 7 November 3rd 06 08:53 AM
7 segment LCD display matt dunbar Excel Programming 1 December 31st 03 01:57 AM


All times are GMT +1. The time now is 01:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"