+ Reply to Thread
Results 1 to 5 of 5

Comment blocks of code using vba

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Comment blocks of code using vba

    Hello everyone

    I have a worksheet_SelectionChange event in a sheet
    I need VBA solution to put blocks of comments on the code to disable it and another code to enable the code and clear comments
    In other words without logging into VBE I need to put comments on all the lines of code
    and another code does the contrast to remove comments which were put on the code

    I hope it is clear
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Comment blocks of code using vba

    Hi,
    Not sure this is feasible easily. What are you trying to achieve?
    It it's to run the code only in certain conditions, why not use a IF THEN ELSE ?
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Comment blocks of code using vba

    Thanka lot for reply Mr. GC Excel
    I just need to disable the events in the code for some time and enable again..
    It's not related to the code itself .. It's a general idea ..
    I imagine two buttons : one for putting comments on the specific code in worksheet_selectionchange and another button to remove comments

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Comment blocks of code using vba

    I'm pretty sure there are other ways to prevent code being executed.

    For example you could turn off events using this.
    Please Login or Register  to view this content.
    That could be applied based on any criteria you have.
    If posting code please use code tags, see here.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Comment blocks of code using vba

    Hi,

    Couple Norie's suggestion in #4 with the If..Then idea in #2 and set a public variable with your buttons that can be read by the IF test.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. GoTo Blocks of code and when they activate.
    By penfold1992 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-16-2013, 12:30 PM
  2. Code advances VERY SLOWLY and blocks after 3 columns of calculations
    By seigna in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-07-2013, 02:57 PM
  3. Using macros to identify blocks of data and summarise those blocks
    By gophbeav in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2012, 04:35 AM
  4. Need help writing a C++ DLL for VB / Excel 2003 using Code::Blocks
    By sarahman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2009, 04:15 AM
  5. [SOLVED] Transposing blocks of cells-What would be the code to do this?
    By Dave in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2006, 12:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1