Hi
I am trying to use VBA to produce a series of message boxes depending on the response to each one.
The whole series is based on a value in A1 and a comment that the user has put in B1
This is a description of the type of thing I want to do:
If value in cell A1 = 0 Then
Bring up message box 1 which includes the text value of B1 and ask the question “has the user included a comment in B1?”
If the answer is yes then bring up message box 2 asking “does the comment indicate that 0 is correct?”
If message box 2 is yes then close message box 2 and go back to cell A1
If message box 2 is no then bring up message box 3 asking “does the comment indicate data is missing?”
If message box 3 is Yes include the text “please include the data” in cell C1
If message box 3 is no include the text “zero cases is correct” in cell C1
If message box 1 is no then include the text “please include a comment in B1” in cell C1
The problem I’m getting is that there are a whole load of nested conditions based on the first message box being ‘Yes’ before I can specify what should happen if the first message box is no.
I can’t get the code to work and some elements don’t seem to run (e.g. where a response to one message box should bring up another it doesn’t always seem to do so and just does nothing instead).
Any suggestions on what the right format would be for writing this code please?
Many thanks
Helen
I am trying to use VBA to produce a series of message boxes depending on the response to each one.
The whole series is based on a value in A1 and a comment that the user has put in B1
This is a description of the type of thing I want to do:
If value in cell A1 = 0 Then
Bring up message box 1 which includes the text value of B1 and ask the question “has the user included a comment in B1?”
If the answer is yes then bring up message box 2 asking “does the comment indicate that 0 is correct?”
If message box 2 is yes then close message box 2 and go back to cell A1
If message box 2 is no then bring up message box 3 asking “does the comment indicate data is missing?”
If message box 3 is Yes include the text “please include the data” in cell C1
If message box 3 is no include the text “zero cases is correct” in cell C1
If message box 1 is no then include the text “please include a comment in B1” in cell C1
The problem I’m getting is that there are a whole load of nested conditions based on the first message box being ‘Yes’ before I can specify what should happen if the first message box is no.
I can’t get the code to work and some elements don’t seem to run (e.g. where a response to one message box should bring up another it doesn’t always seem to do so and just does nothing instead).
Any suggestions on what the right format would be for writing this code please?
Many thanks
Helen