+ Reply to Thread
Results 1 to 8 of 8

Thread: VBA keywords

  1. #1
    Registered User
    Join Date
    09-07-2010
    Location
    dallas
    MS-Off Ver
    Excel 2003
    Posts
    16

    VBA keywords

    Hi...I am working on a long vba code ...attempting to figure out corresponding "End If" for each If statement. Is there some sort of a key combination in vb ..so I could highlight the If statement and it jumps to corresponding End If.. Thank you.

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,206

    Re: VBA keywords

    No, we use indenting practices to make it visually clear which IF / END IF go together:
    If Test = True Then
        'some code
        'some code
        If TestTwo = True Then
            'some code
            If A = B Then
                'do this
            Else
                'do this
            End If
        Else
            'some code
            If B = C Then
                'do this
            Else
                'do this
            End If
        End If
    End If
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-07-2010
    Location
    dallas
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: VBA keywords

    Thank you.. but someone wrote the code without indenting and am trying to debug the code. It is very difficult to find out matching End If for some IF statements. I thought there is a hot key combination for this..

  4. #4
    Valued Forum Contributor jwright650's Avatar
    Join Date
    12-10-2010
    Location
    Va, USA
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    537

    Re: VBA keywords

    Quote Originally Posted by JBeaucaire View Post
    No, we use indenting practices to make it visually clear which IF / END IF go together:
    This VBA newbie(me) is filing this post away for future reference.
    Thanks JB
    Life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
    John Wright

  5. #5
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,759

    Re: VBA keywords

    someone wrote the code without indenting
    Fix it: SmartIndenter
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,263

    Re: VBA keywords

    If I had to read somebody elses code I'd be using http://www.mztools.com/index.aspx

    Look at http://www.mztools.com/v3/download.aspx
    Last edited by MarvinP; 01-28-2011 at 07:06 PM.
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  7. #7
    Valued Forum Contributor jwright650's Avatar
    Join Date
    12-10-2010
    Location
    Va, USA
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    537

    Re: VBA keywords

    shg, MarvinP,


    You guys are gonna fill up my hard drive...LOL


    Good stuff, gonna give all of these a try....

    <heading off to indent my previously written code with shg's indenter>
    Life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
    John Wright

  8. #8
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,206

    Re: VBA keywords

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

+ 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.2.0