Hello,
I have written the following code:
The problem is, that no matter what I type into the prompts (i.e., a "y", "n", or a blank ""), I get the prompts' output as though I had typed in "y"'s for all of them... What am I missing here?
Also, I am aware aware of the other prompt styles, such as the yes/no option boxes, but I prefer this route instead.
Thanks,
This guy
I have written the following code:
Code:
Sub The_Prompts_Nightmare()
On Error Resume Next
Dim q1 As String
Dim q2 As String
Dim q3 As String
Dim q4 As String
q1 = InputBox("Do option 1? (y)", "Q1", "y")
q2 = InputBox("Do option 2 on entire workbook? (y)" & vbNewLine & vbNewLine & _
"Do option 2 on selected cells only? (n)" & vbNewLine & vbNewLine & _
"Or forget this all together (empty box)", "Q2", "")
q3 = InputBox("Do option 3 on entire workbook? (y)" & vbNewLine & vbNewLine & _
"Do option 3 on selected cells only? (n)" & vbNewLine & vbNewLine & _
"Or forget this all together (empty box)", "Q3", "")
q4 = InputBox("Finally, do option 4? (y)", "Q4", "")
MsgBox "q1 = " & q1 & vbNewLine & "q2 = " & q2 & vbNewLine & "q3 = " & q3 & vbNewLine & "q4 = " & q4
If Trim(q1) = "y" Or "Y" Then
MsgBox "q1(y)... Trim(q1) = " & Trim(q1)
'Do some code here
End If
If Trim(q2) = "y" Or "Y" Then
MsgBox "q2(y)... Trim(q2) = " & Trim(q2)
'Do some code here
ElseIf Trim(q2) = "n" Or "N" Then
MsgBox "q2(n)... Trim(q2) = " & Trim(q2)
'Do some code here
End If
If Trim(q3) = "y" Or "Y" Then
MsgBox "q3(y)... Trim(q3) = " & Trim(q3)
'Do some code here
ElseIf Trim(q3) = "n" Or "N" Then
MsgBox "q3(n)... Trim(q3) = " & Trim(q3)
'Do some code here
End If
If Trim(q4) = "y" Or "Y" Then
MsgBox "q4(y)... Trim(q4) = " & Trim(q4)
'Do some code here
End If
End Sub
The problem is, that no matter what I type into the prompts (i.e., a "y", "n", or a blank ""), I get the prompts' output as though I had typed in "y"'s for all of them... What am I missing here?
Also, I am aware aware of the other prompt styles, such as the yes/no option boxes, but I prefer this route instead.
Thanks,
This guy