Error handling
You could change your Subroutines to Functions that return a boolean value
(true/false).
Function acct_6301(someparms as sometypeofvariables) as boolean
if somethingisn'tfound then
acct_6301 = false
else
acct_6301 = true
end if
End Function
Then you could call the function.
Dim OkToContinue as boolean
....
oktocontinue = acct_6301(something)
if oktocontinue then
'it was found
else
'it wasn't found
end if
========
Alternatively, you could set up a public variable:
Public OkToContinue as boolean
and set that to true/false depending on what you find.
Sub Acct_6301()
if something then
oktocontinue = true
else
oktocontinue = false
end if
End sub
And your calling procedure would do:
Call acct_6301(maybe passed parms here???)
if oktocontinue then
'do something
else
call acct_6301
if oktocontinue then
'ok so far
else
call acct_6326
if .....
======
Muddier than you thought?
Sarah at DaVita wrote:
I have a workbook with many sheets. I want to look for specific data and
then do some action. I can get the macro to work until it cannot find what I
am looking for. How do I tell it that if it doesn't find what it was looking
for then to go to a different sub routine? Ie: I am looking for 6301 in
column A if that is not present end sub acct_6301 and go to sub acct_6326
which is looking for a different account if 6326 is found then do something
and then go look for the next one. Clear as mud? Any help would be
appreciated.
--
Dave Peterson
|