hello
i want to enable auser name a sheet he adds.he can decide not to.
suppose he wants to and an inputbox opens,if he changes his mind and press cancel the sheet adds anyway.this is not what i intended.
if he press select i want the macro to end.how caould it be doen?
[VBA]
Sub AddWorksheet6()
On Error Resume Next
Dim response As VbMsgBoxResult
Dim sht As Worksheet
response = MsgBox("Do you want to name the sheet ?" _
, vbQuestion + vbYesNoCancel, "add a new w.s")
Select Case response
Case vbCancel
Exit Sub
Case vbNo
Worksheets.Add
Case vbYes
Worksheets.Add().name = InputBox("enter sheet name", "sheet name", "name goes here")
End Select
MsgBox " new sheet added as requested - " & sht.name, vbInformation, "new sheet added" & " - " & Format(Now, "dd/mm/yy hh:mm:ss")
End Sub
[/VBA]
thanks