Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
subroutine variable decleration issue
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
subroutine variable decleration issue
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 "Christmas May" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Call a subroutine using variable subroutine name | Excel Discussion (Misc queries) | |||
Multiple variable issue | Excel Discussion (Misc queries) | |||
Variable Decleration | Excel Programming | |||
Pass a Variable List Of Values To Subroutine or Function | Excel Programming | |||
system variable representing subroutine name? | Excel Programming |