• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Call macro or skip

what i am trying to do these days is to write a macro that calls 8 macro to run
call macro 1
call macro 2
call macro 3
call macro 4
etg
but in times i want for example to skip macro 2 and run 3 and then skip macro 5 and go to 6. so i am thinking of a message to prompt if i want to run macro or no and if no to go to next. i think for that i will manage to write the code.
is there any way to have a user form or something that can tick which macro to run or not?

i found this code
{ Call macro 1
Dim varResponse As Variant

varResponse = MsgBox("Select 'Yes' or 'No'", vbYesNo, "Selection")
If varResponse <> vbYes Then Exit Sub
' The rest of your code goes here
Call macro 2}
now i have to find not to exit sub but skip
any ideas? could i use this code "On Error GoTo"
 
Last edited:
Hi ,

You could have something like this :
Code:
Dim varResponse As Variant

varResponse = MsgBox("Do you wish to run the macro 1 ? Select 'Yes' or 'No'", vbYesNo, "Selection")
If varResponse = vbYes Then
  Call proc1
End If

varResponse = MsgBox("Do you wish to run the macro 2 ? Select 'Yes' or 'No'", vbYesNo, "Selection")
If varResponse = vbYes Then
  Call proc2
End If
Narayan
 
sorry mark l i can't understand your reply
It just means « The better initial explanation and attachment,
the better & quicker solution ! »

So with smart names of procedures to launch
- the real ones you forgot to explain as we can't guess ! -
a code of 3 codelines only should be necessary …

And better than a prompt for each procedure to run or not
is to ask at once which procedures # must be launched.
 
Ok i will try to explain what i was meaning before only for the discussion of the thread because NARAYANK991 gave me the solution to my code
.so if i tick macro 2 .3. and 5 then only these macros will run and the other 1 4 6 7 and 8 will skip from running.
 

Attachments

  • 2018-05-04_152948.jpg
    2018-05-04_152948.jpg
    37.7 KB · Views: 7

As yet asked : what is the real procedures names in the VBA code ?!

As it is very not difficult to post procedures code
or better to just join an attachment 'cause of the UserForm now …
 
I asked cause "macro 1" can't be a valid procedure name !

The reason why we wanna see source code
or better a workbook attachment in case of using an UserForm.

As with an UserForm both checkboxes & procedures names
must be enough smart for a 3 codelines only clever code …
 
Can we close the thread because i can't understand your questions
i realize your willing to help and i appreciate that but for now i found the solution to my problem and is function.
 
Back
Top