Looking for an alternative programming technique

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

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

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

Back
Top