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 |
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 |
All times are GMT +1. The time now is 02:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com