ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   minimum # of variables (https://www.excelbanter.com/excel-programming/278959-minimum-variables.html)

Jamie Martin[_2_]

minimum # of variables
 
This is probably a complicated question . . .

I have just finished a fairly large (for me) sub procedure. I think I may
have ended up using one or two more variables than I needed. Is there a way
I can verify that I have used the minimum number of variables that will do
the task?

Thanks again, everybody, for your excellent advice . . .

Jamie



Jim Rech

minimum # of variables
 
Is there a way I can verify that I have used the minimum number of
variables that will do the task?

Not really, if you're looking for something automatic or automated. If you
think you've declared variables that you do not use you can do a Find on
them, limiting the Find scope to the current procedure. If it's just one or
two, as you said, it is not worth the bother however,

A better question might be, if your procedure is so big that it's hard to
know what variables are used in it, whether you shouldn't have chunked out
your code into smaller, easier to understand and maintain, sub procedures.


--
Jim Rech
Excel MVP



Haldun Alay[_2_]

minimum # of variables
 
hi,
visit http://www.mztools.com/ and download mz-tools.
that add-in has several utilities for vba codes like "Review Source Code".
when you run that utility, it shows unused variables in project.


Regards

Haldun


"Jamie Martin" , iletide şunu yazdı
...
This is probably a complicated question . . .

I have just finished a fairly large (for me) sub procedure. I think I may
have ended up using one or two more variables than I needed. Is there a

way
I can verify that I have used the minimum number of variables that will do
the task?

Thanks again, everybody, for your excellent advice . . .

Jamie






All times are GMT +1. The time now is 08:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com