Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Goto...Return question

Hi,

Here's part of my code:

Function doProcess(input as string) as integer
'(...code here)
Goto CleanUp
'(...code here)
Exit Function
CleanUp:
'(...code here)
if flag = true then
Return 'here I need to resume the
'function after the "Goto CleanUp" line
end if
'(...code here)
End Function

Here's the problem:
The "Return" line doesn't work. What do I need to write instead?
I'm using Goto because that part of the code is used many many times in
that function and I cannot rewrite it as another function.

Thanks

MouseTrap
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Goto...Return question


Change Goto Cleanup to GoSub Cleanup


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Goto...Return question

Instead of "Return", use "Resume Next".

--

Vasant

"mousetrap" wrote in message
...
Hi,

Here's part of my code:

Function doProcess(input as string) as integer
'(...code here)
Goto CleanUp
'(...code here)
Exit Function
CleanUp:
'(...code here)
if flag = true then
Return 'here I need to resume the
'function after the "Goto CleanUp" line
end if
'(...code here)
End Function

Here's the problem:
The "Return" line doesn't work. What do I need to write instead?
I'm using Goto because that part of the code is used many many times in
that function and I cannot rewrite it as another function.

Thanks

MouseTrap



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Goto...Return question

In article ,
"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote:

Instead of "Return", use "Resume Next".

--


I already tried that. I get an error: Resume without error.

MouseTrap
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Goto...Return question

In article ,
mudraker wrote:

Change Goto Cleanup to GoSub Cleanup



I thought that GoSub worked only in a Sub and not in a function.
However, I tried it and it worked. Thanks.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Goto...Return question

My mistake ... I thought Cleanup was your error handler, but obviously it is
not!

--

Vasant

"mousetrap" wrote in message
...
In article ,
"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote:

Instead of "Return", use "Resume Next".

--


I already tried that. I get an error: Resume without error.

MouseTrap



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on "On Error GoTo skip" dan Excel Discussion (Misc queries) 2 July 1st 07 10:48 PM
goto (F5) question dford Excel Discussion (Misc queries) 2 January 13th 07 04:54 AM
Validation Data & Goto question ma Excel Discussion (Misc queries) 2 March 1st 05 08:54 PM
VBA rookie question - listbox and GOTO Harald Staff[_4_] Excel Programming 3 September 7th 03 04:55 PM
Question: OPEN return status Frederik Romanov Excel Programming 0 July 8th 03 12:40 PM


All times are GMT +1. The time now is 02:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"