ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looking for an alternative programming technique (https://www.excelbanter.com/excel-programming/399009-looking-alternative-programming-technique.html)

Tom

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



eliano

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




Tom

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







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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com