I have a user 4 that has 4 selections, and an accept button. Currently, if the user doesn't make a selection, but clicks the "ACCEPT" button, I get this error:
Run-time error '9'
Subscript out of range
Is there a way to popup a message box, or anything else, that would prompt the user to make a selection? Here is my userform code:
Code
Option Explicit
Public wsName As String
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Cancel = Not CloseMode
End Sub
Private Sub Accept_Click()
Dim ws As Worksheet
Worksheets(wsName).Select
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then
ws.Visible = xlSheetVeryHidden
End If
Next ws
Unload UserForm1
End Sub
Private Sub opt1_Click()
wsName = Me.opt1.Caption
End Sub
Private Sub opt2_Click()
wsName = Me.opt2.Caption
End Sub
Private Sub opt3_Click()
wsName = Me.opt3.Caption
End Sub
Private Sub opt4_Click()
wsName = Me.opt4.Caption
End Sub
Display More
Thanks very much,
D0M