Home Call to a different macro at a certain line
Reply: 2

Call to a different macro at a certain line

CptGoodar
1#
CptGoodar Published in 2017-12-07 14:20:35Z

I have a new question, is it possible to use the call feature to call a macro at a specific line? i ask as the macro i am coding does this - Run 1st half of code, then based upon user choices open up a custom UserForm, run UserFrom command buttons, after this i need a command button to go back to the code the line after the UserForm was used. The userForm worked as intended and many different stats calc can be run and has a button that returns the user back to the rest of the code, but i can't get that to work. I have tried using both GoTo statements and the Call feature (The most promising solution) but have had no success so far.

Thanks in advanced for any help you can provide.

Mark

David G.
2#
David G. Reply to 2017-12-07 14:50:11Z

There are several ways to achieve it, I will show one of them.

You can modify your procedure (macro) asking for a value as optional.

Sub MyMacro(Optional Answer As Boolean)

   If Answer = True then
       'Do some stuff
   Else
       'Do some stuff
   End If

End Sub

As Answer is optional you can call your Macro with or without arguments. Suppose you call your Macro from your user form:

Call MyMacro(True) 

Hope this give you some hints.

ryguy72
3#
ryguy72 Reply to 2017-12-08 20:01:11Z

You can use VBA for this, but I would recommend using the Windows Task Scheduler. I think that will be a lot better, all things considered.

https://www.digitalcitizen.life/how-create-task-basic-task-wizard

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.24343 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO