PC Review


Reply
Thread Tools Rate Thread

Check for unnecessary Public variable declarations and duplicate Set statements

 
 
IanKR
Guest
Posts: n/a
 
      31st Jul 2008
I already use Rob Bovey's excellent code cleaner [
http://www.appspro.com/Utilities/CodeCleaner.htm ] but I was wondering
whether something exists that checks for duplicate Set statements and
unnecessarily declared variables in a project?

I have a project that has evolved over a couple of weeks, and I've refined
it to be a lot smaller than it once was. The code is spread across 12
modules and I declare all the variables as Public in a module on their own.
The variables are mostly Workbooks, Worksheets and Ranges, but there are
also Integers and Longs, and there are a lot of them (100+). I know that
some of the variables aren't actually used in any of the modules, after the
refining that I've done to the project over the weeks.

The code is made up of one or two Sub procedures per module - some very
long - with a master Sub calling the other Subs in sequence. During testing
of the separate procedures I've had to copy in a lot of the Set statements
(to define Workbook, Worksheet and Range variables) at various points in
each procedure, so that I can test each Sub in isolation. But now that the
Project is finished I've put all these Set statements at the beginning of
the master Sub, which means that they're not now needed in the individual
Subs.

Short of using the Find tool in the VBE to look for unused variables and
duplicate Set statements, is there a quick of doing this?

TIA

Ian

 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      31st Jul 2008
Check out this addin. It will make your coding life a whole pile easier,
inclucing a feature to review your source code looking for unused variables
and such...

http://www.mztools.com/index.aspx
--
HTH...

Jim Thomlinson


"IanKR" wrote:

> I already use Rob Bovey's excellent code cleaner [
> http://www.appspro.com/Utilities/CodeCleaner.htm ] but I was wondering
> whether something exists that checks for duplicate Set statements and
> unnecessarily declared variables in a project?
>
> I have a project that has evolved over a couple of weeks, and I've refined
> it to be a lot smaller than it once was. The code is spread across 12
> modules and I declare all the variables as Public in a module on their own.
> The variables are mostly Workbooks, Worksheets and Ranges, but there are
> also Integers and Longs, and there are a lot of them (100+). I know that
> some of the variables aren't actually used in any of the modules, after the
> refining that I've done to the project over the weeks.
>
> The code is made up of one or two Sub procedures per module - some very
> long - with a master Sub calling the other Subs in sequence. During testing
> of the separate procedures I've had to copy in a lot of the Set statements
> (to define Workbook, Worksheet and Range variables) at various points in
> each procedure, so that I can test each Sub in isolation. But now that the
> Project is finished I've put all these Set statements at the beginning of
> the master Sub, which means that they're not now needed in the individual
> Subs.
>
> Short of using the Find tool in the VBE to look for unused variables and
> duplicate Set statements, is there a quick of doing this?
>
> TIA
>
> Ian
>
>

 
Reply With Quote
 
IanKR
Guest
Posts: n/a
 
      31st Jul 2008
> Check out this addin. It will make your coding life a whole pile easier,
> inclucing a feature to review your source code looking for unused
> variables
> and such...
>
> http://www.mztools.com/index.aspx
> --
> HTH...
>
> Jim Thomlinson


Many thanks for your very fast reply, Jim. I've tried the VBA add-in - it's
just what I needed!

Ian

 
Reply With Quote
 
Jim Thomlinson
Guest
Posts: n/a
 
      31st Jul 2008
There are pile of great features in that one. It is definitly worth spending
a bit of time investigating... It will save you hours if you do much coding.
--
HTH...

Jim Thomlinson


"IanKR" wrote:

> > Check out this addin. It will make your coding life a whole pile easier,
> > inclucing a feature to review your source code looking for unused
> > variables
> > and such...
> >
> > http://www.mztools.com/index.aspx
> > --
> > HTH...
> >
> > Jim Thomlinson

>
> Many thanks for your very fast reply, Jim. I've tried the VBA add-in - it's
> just what I needed!
>
> Ian
>
>

 
Reply With Quote
 
Dick Kusleika
Guest
Posts: n/a
 
      1st Aug 2008
On Thu, 31 Jul 2008 20:47:27 +0100, "IanKR" <ik.rip_@_ntlworld.com> wrote:

>I already use Rob Bovey's excellent code cleaner [
>http://www.appspro.com/Utilities/CodeCleaner.htm ] but I was wondering
>whether something exists that checks for duplicate Set statements and
>unnecessarily declared variables in a project?
>
>Short of using the Find tool in the VBE to look for unused variables and
>duplicate Set statements, is there a quick of doing this?


Try http://www.mztools.com/index.aspx
--
Dick
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable declarations.... in VB.Net Pete Smith Microsoft VB .NET 5 7th Feb 2006 01:18 AM
Declarations Procedure and Duplicate Declarations =?Utf-8?B?TmVhbCBaaW1t?= Microsoft Excel Programming 3 31st May 2005 01:01 AM
'Imports' statements must precede any declarations David Lozzi Microsoft ASP .NET 2 9th Aug 2004 07:23 PM
Check to see if variable is duplicate. ianripping Microsoft Excel Programming 7 8th May 2004 11:37 AM
variable declarations joten Microsoft Access Getting Started 1 12th Jan 2004 02:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:45 AM.