Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 20
Default Looking for an alternative programming technique

I have five lines of codes which are used several times over in different
parts of the same program. I could treat them as a separately named
procedure, and call on that name but I wonder if there is a simpler way.
With Excel4 macro it was easy to loop using the "Goto" command. Is there
something similar with VBA? Any other suggestions?

TIA
Tom


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Looking for an alternative programming technique

Hi Tom.
Try:

Public Sub fivelinesofcode()
€¦your five lines of code
End sub

Public Sub Mastercode()
€¦your code
fivelinesofcode
€¦your code
fivelinesofcode
€¦your code
fivelinesofcode
End Sub

Pay attention.
Variables in your five lines code might be defined as Public

Regards
Eliano

"Tom" wrote:

I have five lines of codes which are used several times over in different
parts of the same program. I could treat them as a separately named
procedure, and call on that name but I wonder if there is a simpler way.
With Excel4 macro it was easy to loop using the "Goto" command. Is there
something similar with VBA? Any other suggestions?

TIA
Tom



  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 20
Default Looking for an alternative programming technique

Thanks. It's a fraction shorter, I think.

Regards,
Tom
"eliano" wrote in message
...
Hi Tom.
Try:

Public Sub fivelinesofcode()
.your five lines of code
End sub

Public Sub Mastercode()
.your code
fivelinesofcode
.your code
fivelinesofcode
.your code
fivelinesofcode
End Sub

Pay attention.
Variables in your five lines code might be defined as Public

Regards
Eliano

"Tom" wrote:

I have five lines of codes which are used several times over in different
parts of the same program. I could treat them as a separately named
procedure, and call on that name but I wonder if there is a simpler way.
With Excel4 macro it was easy to loop using the "Goto" command. Is there
something similar with VBA? Any other suggestions?

TIA
Tom





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
Paste Special (or some other technique) Gina_Marano Excel Discussion (Misc queries) 4 April 23rd 08 09:11 PM
TIP: Powerful automation technique Dermot Excel Discussion (Misc queries) 2 August 11th 06 10:43 AM
Best Technique to clone worksheet Rich_z[_21_] Excel Programming 4 July 6th 05 07:56 PM
Hide Password Technique ??? Neal Zimm Excel Programming 2 April 21st 05 06:46 AM
Programming of alternative actions in VB macros Matt Excel Programming 1 November 25th 04 11:18 AM


All times are GMT +1. The time now is 06:17 PM.

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"