+ Reply to Thread
Results 1 to 12 of 12

Is there an EASY way to find unused declared variables?

  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    579

    Is there an EASY way to find unused declared variables?

    In working and reworking and reworking some modules I find myself with a bunch of declared variables that I am no longer using, but out of fear of deleting a group and finding I have to go back and redeclare, I just let them be. Is there an easy way, perhaps with code or a 3rd party program, to run through a module and identify everything that was declared but not used?

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Is there an EASY way to find unused declared variables?

    You could try deleting them one at a time and (assuming option explicit is set) attempt to compile the code.
    Martin

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Is there an EASY way to find unused declared variables?

    Hi brucemc777

    Download MZ Tools (free). One of the available Utilities is Review Source Code. It'll tell you if you've defined a Variable and it's not used in the Code.

    http://www.mztools.com/index.aspx
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    579

    Re: Is there an EASY way to find unused declared variables?

    THANK-YOU!!!

    and HAPPY FATHER'S DAY!!!

    i thought both items appropriate for shouting...

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Is there an EASY way to find unused declared variables?

    Hi brucemc777

    Back at you...SHOUTING

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Is there an EASY way to find unused declared variables?

    Hi brucemc777

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  7. #7
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    579

    Re: Is there an EASY way to find unused declared variables?

    Seemed to me that it might of been more prudent to have a chance to download and put the program through it's paces, then post a review letting folks know if it, in fact, did solve the issue and what other aspects I note, but I suspect by looking at the website that it will, so "solved".

  8. #8
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    579

    Re: Is there an EASY way to find unused declared variables?

    OK, I have only scratched the surface. For all of us VBA folks, FREE and OUTSTANDING. If I had the time to dive into VB or .net, I suspect the field of utilities would be larger but this would definitely be in the running. If you do work in VBA and don't yet have this, get it. Unless it somehow erases all my code at some point, I doubt I will recant those words-

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Is there an EASY way to find unused declared variables?

    Hi brucemc777

    I'd also recommend Smart Indenter
    http://www.oaltd.co.uk/indenter/indentpage.asp

    and ASAP Utilities
    http://www.asap-utilities.com/

  10. #10
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    579

    Re: Is there an EASY way to find unused declared variables?

    Thank you, very much.

    I am a long time user of Navigator Utilities for Excel
    http://www.navigatorutilities.com/
    Are you familiar with this? Wondering how it compare to ASAP in use. I expect to find out for myself, but just in case I can speed up the learning process...!

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Is there an EASY way to find unused declared variables?

    Hi Bruce

    I'm not familiar with Navigator Utilities for Excel. I'll look at it, thanks for the heads up. Do look at Smart Indenter...use it ALL the time...as I do MZ Tools .

    Happy hunting.

  12. #12
    Registered User
    Join Date
    01-14-2013
    Location
    Dorset, UK
    MS-Off Ver
    Excel 2016
    Posts
    3

    Re: Is there an EASY way to find unused declared variables?

    Just to update the info on MZ-Tools, it's free to download for a 30 day free trial, but thereafter you have to buy a licence.

+ 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. Do/Loop Until using variables declared
    By LLL0422 in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 06-05-2014, 09:01 AM
  2. Problem with public global declared variables
    By vonb3ta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-03-2013, 07:20 AM
  3. [SOLVED] Macro for autofilter using variables declared in worksheet
    By Jeff in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  4. [SOLVED] Macro for autofilter using variables declared in worksheet
    By Jeff in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. [SOLVED] Macro for autofilter using variables declared in worksheet
    By Jeff in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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