+ Reply to Thread
Results 1 to 7 of 7

Commenting out parts of a Macro?

  1. #1
    Registered User
    Join Date
    03-07-2007
    Posts
    74

    Commenting out parts of a Macro?

    How do you prevent certain parts of a macro from running?
    I realize if you apply an ' it will prevent that line form running. whats an easy way of preventing multiple lines from running?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Use a compiler directive:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Or Right click the gray toolbar > select Customise > Commands Tab > Edit > select comment block and drag to the toolbar > repeat the same for Unblock

    Then select the Lines to comment out and press the button

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Registered User
    Join Date
    03-07-2007
    Posts
    74
    Perfect. thats what I am talking about!

    Thank you both.

    While I have you, how would I do this:

    I have Excel files that are the results of several different selection criteria from a database. Each file is named differently and the tabs are named different also. I currently have to save the file to a standard naming convention and change the tab name before I can run the macro.

    I would like to be able to just run the macro (with the additional code ) and let it do the name assigning itself?

    Any help would be most helpful. Please use laymen’s terms as I am not an expert in VB. For ex; how to actually word it in the macro.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    That's unrelated to this thread's topic. Please start a new one.

  6. #6
    Registered User
    Join Date
    03-07-2007
    Posts
    74

    I did "How to assign a variable in a macro? "

    But I didn't understand a reply and thought it might help to get additional eyes?

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Then continue in that thread, please.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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