
Originally Posted by
charley
this is my first post on the forum so hi to all..
i am just learning vba and and am a complete amateur, but i have created several mini macros (because i dont' know how to link various commands to gether in one macro) that i would like to chain together so that one click will fire them all off in succession. I have tried this by just creating one mother macro and inputting the names of the mini macros, but the 1st macro requires user unput ie: answer yes or no to deletion of columns. this causes the automation of the the following macros to screw up.
I have also tried a wait commend without success..(prob because i dont fully understand the syntax or method)
What I would like if poss - is for there to be a pause when the 1st macro asks for a reply and only continues upon replies OR for the answers to be answered automatically with "yes" twice, so that the remainder of the script will run smoothly
I have attached a notepad file showing the script of the mini macros in order. Could someone possibly advise me how as to how i can achieve what i am after please.
any help or tips would be great
many thanks
charley
Hi,
If as you say the main macro requires a Yes/No answer to proceed, that implies that you are throwing up a Message Box inviting the user to choose a Yes or No button. In which case whichever button the user presses returns a value to the macro. If Yes is pressed the answer is 6, if No the result is 7.
Hence you need to test for a Yes/No answer with and IF..THEN test.
The way I usually do this is to set a variable for the answer, e.g. Dim iAnswer as Integer. Then for the Message Box line use:
iAnswer = MsgBox ("Your prompt",vbYesNo)
now use the iAnswer
Hope this gives some ideas.
Bookmarks