PC Review


Reply
Thread Tools Rate Thread

Avoiding goto

 
 
=?Utf-8?B?QW50b25pbw==?=
Guest
Posts: n/a
 
      3rd Nov 2006
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...)


 
Reply With Quote
 
 
 
 
=?Utf-8?B?QW50b25pbw==?=
Guest
Posts: n/a
 
      3rd Nov 2006
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...)



"Antonio" wrote:

> 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...)
>
>

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      3rd Nov 2006
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

--
Regards,
Tom Ogilvy


"Antonio" wrote:

> 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...)
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
when i build someone's project, and right click a function "goto definition" is disabled. how to reconfigure a .net project to support "goto definition" when i right click on function calls? DR Microsoft C# .NET 4 9th Jan 2008 04:31 PM
when i build someone's project, and right click a function "goto definition" is disabled. how to reconfigure a .net project to support "goto definition" when i right click on function calls? DR Microsoft VB .NET 2 9th Jan 2008 02:09 PM
On Error Goto doesn't goto =?Utf-8?B?UGF1bA==?= Microsoft Excel Programming 1 15th Oct 2004 03:51 PM
On Error Goto doesn't goto =?Utf-8?B?UGF1bA==?= Microsoft Excel Programming 0 15th Oct 2004 03:05 PM
two field on the form goto another field then goto table M. Shahab Microsoft Access 0 14th Jul 2003 09:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:08 PM.