Hi guys and gals! I hope this might be something someone can shed some light on for me!
I've got an input box that opens up to rename an excel sheet. The trouble is...I get a run-time error if the user clicks cancel before entering in a name. The second message box (which verifies the users input) works just as I intended.
Also...worksheet names have limitations on what characters can be used.
I'd like to pop up a message if the user clicks cancel...or alternatively set a default name to be used.
I need some direction to get me on the right track. Thanks for any...input...you can give (pardon the pun)
Here is what I have so far:
Sheets("MB Percentages").Select
MBperReN:
Workbooks(MyPRbk).Activate
Sheets(1).Name = InputBox("Enter the name of the new sheet")
' If the user clicks cancel or enters unacceptable characters here we have a problem....
Msg = "Is the new sheet named correctly?"
Style = vbYesNo + vbCritical + vbDefaultButton1
Title = "Attention:"
Help = "PPER.HLP"
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then
MyString = "Yes"
Else
MyString = "No"
GoTo MBperReN
End If
I've got an input box that opens up to rename an excel sheet. The trouble is...I get a run-time error if the user clicks cancel before entering in a name. The second message box (which verifies the users input) works just as I intended.
Also...worksheet names have limitations on what characters can be used.
I'd like to pop up a message if the user clicks cancel...or alternatively set a default name to be used.
I need some direction to get me on the right track. Thanks for any...input...you can give (pardon the pun)
Here is what I have so far:
Sheets("MB Percentages").Select
MBperReN:
Workbooks(MyPRbk).Activate
Sheets(1).Name = InputBox("Enter the name of the new sheet")
' If the user clicks cancel or enters unacceptable characters here we have a problem....
Msg = "Is the new sheet named correctly?"
Style = vbYesNo + vbCritical + vbDefaultButton1
Title = "Attention:"
Help = "PPER.HLP"
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then
MyString = "Yes"
Else
MyString = "No"
GoTo MBperReN
End If