Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / June 2006

Tip: Looking for answers? Try searching our database.

subroutine variable decleration issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christmas May - 30 Jun 2006 22:56 GMT
The following works:

sub subroutine(optional Byval strVariable as string = "Default String")

Can I do something similar to the following, which doesn't work?

sub subroutine2(optional byval rngVariable as range = range("A1:B2"))

Also are these routines public or private?

Thanks in advance,

Christmas May
Norman Jones - 30 Jun 2006 23:03 GMT
Hi Chritmas,

Try:

Sub subroutine2(Optional rng As Range)

   If rng Is Nothing Then Set rng = Range("A1:B2")

> Also are these routines public or private?

That depends on the required scope.

Lokk in VBA help for 'Scope', 'Private' and 'Public'

---
Regards,
Norman

> The following works:
>
[quoted text clipped - 9 lines]
>
> Christmas May
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.