Avoiding goto

A

Antonio

How do I avoid the goto line1 and goto line2 in the following code?

For client_index = 1 To number_of_clients

If shares_traded_for_client(client_index) = 0 Then GoTo line1


(..more code..)

If asset_class = "INDEX" Then GoTo line2

(...more code..)

line2:

ActiveWorkbook.Close SaveChanges:=True

line1:

Next client_index


(... more code...)
 
A

Antonio

done

For client_index = 1 To number_of_clients

If Not shares_traded_for_client(client_index) = 0 Then


(..more code..)

If Not asset_class = "INDEX" Then

(...more code..)

End If

ActiveWorkbook.Close SaveChanges:=True

End If

Next client_index


(... more code...)
 
T

Tom Ogilvy

For client_index = 1 To number_of_clients

If shares_traded_for_client(client_index) <> 0 Then

If asset_class <> "INDEX" Then

(...more code..)

End if

ActiveWorkbook.Close SaveChanges:=True
End if

Next client_index
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top