Reputation: 89
Is it possible to call a sub and have the sub run with the exception of a few lines within the sub that is being called?
So for example, I want to call a "master_clear" sub from my "main" sub, but I do not want the master_clear to clear everything; there are some ranges that need to be left. How can I do this?
Upvotes: 0
Views: 76
Reputation: 12748
You can use an optional parameter.
Sub foo(someParam as String, Optional doExtra as Boolean = False)
'Do stuff
If doExtra Then
'Do extra stuff
End If
'Do some more stuff
End Sub
Sub bar
foo "hello" ' skip extra stuff
foo "bye", True ' do extra stuff
End Sub
Upvotes: 3