Share via

VBA - Collapse Code

Anonymous
2017-08-09T10:48:01+00:00

Hi everyone,

Not in need of any programming help today however more VBA editor support.

Is there a way for me to highlight a specific range of code I've made and then collapse it into 1 line? I can do this in Dreamweaver but as I'm using VBA right now I wondered if it had the same functionality?

My UserForm Module is massive and it takes forever to find the specific location I'm looking for in order to edit code.

Any ideas?

Thanks,

Daniel

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2017-08-09T13:37:33+00:00

If you go into the VBE and then in the menu choose tools=>Options

then on the editor tab, uncheck  "Default to full module view", then it will just show the current procedure.   You can choose the right dropdown at the top of the module to select which procedure you want to look at. 

I am not sure this is what you are describing, but it may provide something close to what you need.

--

Regards,

Tom Ogilvy

Was this answer helpful?

4 people found this answer helpful.
0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-08-09T14:53:08+00:00

    Thank you for all the replies.

    While the first option by Tom was very helpful it doesn't have the desired effect. It hides all of it and then I need to hunt/remember where the code is.

    Effectively my Userform Module has a MultiPage setup which all contain some lengthy code. I wanted to be able to highlight all of the code for 1 MultiPage Page (I've got the code organized into sections) and then hide it. Dreamweaver adds a nice "..." with the first line of code so that it's easy to understand which block of code is which.

    I don't think the VBE has it built in, which is a shame really. I do feel like the VBE could do with an upgrade that's for sure!

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2017-08-09T13:55:41+00:00

    Daniel,

    re: specific location in VBE

    If there is a semi-unique expression in the specific code range you are looking for then using Edit | Find from the VBE menubar can be very helpful.

    Also, using a bookmark (from the menubar toolbar) allows you return to a particular code section later on in the session.

    '---

    Jim Cone

    Portland, Oregon USA

    https://goo.gl/IUQUN2 (Dropbox)

    (free & commercial excel add-ins & workbooks)

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-08-09T13:44:10+00:00

    Hi,

    MZTools has such option but it is not freeware. Have a look: www.mztools.com

    Was this answer helpful?

    0 comments No comments