Calling my macro is only working if certain options are selected
Which ever way this piece of macro executes it will always end up calling the
addnewsheet macro. I notice we only have questions 4E and 4F here so on the
assumption there are earlier questions then it may be that something in an
earlier part of the macro is causing your problem.
Mike
" wrote:
Hi there I have attached at the bottom a piece of code from a
questionnaire I have made (with lots of help) and it calls a macro
called addNewSheet at the end - for some reason this only works if
they select yes for the final bit and if they select no nothing
happens. Would anyone know where I am going wrong?
detri = MsgBox("Question 4e. Could this information have had a
detrimental effect on KM if it fell into the wrong hands?", vbYesNo)
If detri = vbYes Then
Range("D18") = "Question 4e. Could this information have had a
detrimental effect on KM if it fell into the wrong hands?"
Range("E18") = "Yes"
Range("E18").Font.ColorIndex = 5
WhyDetri = InputBox("Question 4f. Why?")
Range("D19") = "Question 4f. Why?"
Range("E19") = WhyDetri
Range("E19").Font.ColorIndex = 5
Columns("E").AutoFit
Range("D13:E19").BorderAround ColorIndex:=xlAutomatic,
Weight:=xlMedium
Range("D13:E19").Borders(xlInsideHorizontal).LineS tyle =
xlContinuous
Range("D13:E19").Borders(xlInsideVertical).LineSty le =
xlContinuous
Else
Range("D18") = "Question 4e. Could this information have had a
detrimental effect on KM if it fell into the wrong hands?"
Range("E18") = "No"
Range("E18").Font.ColorIndex = 5
Columns("E").AutoFit
Range("D13:E18").BorderAround ColorIndex:=xlAutomatic,
Weight:=xlMedium
Range("D13:E18").Borders(xlInsideHorizontal).LineS tyle =
xlContinuous
Range("D13:E18").Borders(xlInsideVertical).LineSty le =
xlContinuous
End If
Call addNewSheet
End Sub
|