Hi,
Trying to use the following code that if my inputbox is empty then display a msgbox vbyesno asking if i'm sure I want to continue.. however I can't get control over the 2nd argument, excel just passes through the second argument no matter what is in there. (see line in bold, if I click no it won't do anything), I've tried adding another if vbno then but that doesn't prevail :D
What I need is if vbyes then do nothing, if vbno then use another inputbox..
How can I do this with select case AND if?
Trying to use the following code that if my inputbox is empty then display a msgbox vbyesno asking if i'm sure I want to continue.. however I can't get control over the 2nd argument, excel just passes through the second argument no matter what is in there. (see line in bold, if I click no it won't do anything), I've tried adding another if vbno then but that doesn't prevail :D
What I need is if vbyes then do nothing, if vbno then use another inputbox..
How can I do this with select case AND if?
Code:
Sub InputBoxes()
Dim title As String, week As String
Dim rng1 As Range, rng2 As Range
Set rng1 = Sheets(1).Range("A1")
title = InputBox("Please enter the title of the sheet.")
rng1.Value = title
If title = "" Then
MsgBox "You haven't entered a title, are you sure you want to continue?", vbYesNo + vbExclamation
If vbYes Then
'do nothing
Else
[B] rng1.Value = InputBox("Please enter the title of the sheet.")[/B]
End If
End If
End Sub
Last edited: