PC Review


Reply
 
 
David
Guest
Posts: n/a
 
      4th Mar 2010
Hello Group,

I have a program that exceeded the allowable amount of code. Because of this
I had to create a call to anothe Sub. All it does is do some calculation on
the worksheet, but it appears as a Sub in the list of available subs. Since
it is a Call, I would not like it to appear in the list. I would not like
anyone to try and run it independantly. Can I make it disappear from the
available list?

Thanks,
David
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      4th Mar 2010

You can label it as
private sub mysub()

However, I'll bet your original can be reduced. You are probably using
selections etc. Post it

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"David" <(E-Mail Removed)> wrote in message
news:101244A3-3962-4D0D-AED6-(E-Mail Removed)...
> Hello Group,
>
> I have a program that exceeded the allowable amount of code. Because of
> this
> I had to create a call to anothe Sub. All it does is do some calculation
> on
> the worksheet, but it appears as a Sub in the list of available subs.
> Since
> it is a Call, I would not like it to appear in the list. I would not like
> anyone to try and run it independantly. Can I make it disappear from the
> available list?
>
> Thanks,
> David


 
Reply With Quote
 
Martin Brown
Guest
Posts: n/a
 
      4th Mar 2010
David wrote:
> Hello Group,
>
> I have a program that exceeded the allowable amount of code. Because of this
> I had to create a call to anothe Sub. All it does is do some calculation on
> the worksheet, but it appears as a Sub in the list of available subs. Since
> it is a Call, I would not like it to appear in the list. I would not like
> anyone to try and run it independantly. Can I make it disappear from the
> available list?


Ignoring the fact that monolithic slabs of code like that will be a
horrible maintenance trap that will come back to haunt you.
Two easy ways to hide internal subroutines:

Declare them as "private" or give them parameters. The latter offers a
way to parameterise your problem and avoid spurious duplication of code.

Regards,
Martin Brown
 
Reply With Quote
 
David
Guest
Posts: n/a
 
      4th Mar 2010
Thanks Don.

That did it and I just went through another sub and reduced it by over 50%,
so you are right. It is mostly a time and effort thing.

Thanks Again,
David

"Don Guillett" wrote:

>
> You can label it as
> private sub mysub()
>
> However, I'll bet your original can be reduced. You are probably using
> selections etc. Post it
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> (E-Mail Removed)
> "David" <(E-Mail Removed)> wrote in message
> news:101244A3-3962-4D0D-AED6-(E-Mail Removed)...
> > Hello Group,
> >
> > I have a program that exceeded the allowable amount of code. Because of
> > this
> > I had to create a call to anothe Sub. All it does is do some calculation
> > on
> > the worksheet, but it appears as a Sub in the list of available subs.
> > Since
> > it is a Call, I would not like it to appear in the list. I would not like
> > anyone to try and run it independantly. Can I make it disappear from the
> > available list?
> >
> > Thanks,
> > David

>
> .
>

 
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
Call a javascript when i call an aspx page with a form html not running on server Fabio Mastria Microsoft ASP .NET 4 28th Jan 2008 09:05 AM
Warning 1684 CA2214 : Microsoft.Usage : 'RandomShade..ctor(Int32, Int32, Int32, Int32, Int32)' contains a call chain that results in a call to a virtual method defined by the class. Review the following call stack for unintended consequences: steve bull Microsoft C# .NET 4 7th Jul 2005 05:54 PM
Are we new users supposed to call this number? I have auto dial on my XP in the dialer but am I required to call? Windows XP New Users 12 26th May 2005 03:47 PM
An outgoing call cannot be made since the application is dispatching an input-synchronous call Sagaert Johan Microsoft C# .NET 4 6th Apr 2005 12:12 AM
Re: Please help - How to call functions that exists in the main application. The call should be initiated from one of the components. Baavgai Microsoft C# .NET 0 4th Sep 2004 05:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:10 PM.