Hi
I want when I select sheet from combobox on userform show me inpubox to write password if it is right then will show sheet if it's wrong password then should keep hidden .
note: if I select another sheet then should hide the previous sheet , just show the selected sheet if it's right .
thanks
I want when I select sheet from combobox on userform show me inpubox to write password if it is right then will show sheet if it's wrong password then should keep hidden .
note: if I select another sheet then should hide the previous sheet , just show the selected sheet if it's right .
VBA Code:
Private Sub CommandButton2_Click()
On Error GoTo ErrHandler
If ComboBox1.Text = "" Then
MsgBox "select sheet first"
Else
For ii = 1 To Sheets.Count
Sheets(ii).Visible = xlSheetVisible
Next
For i = 1 To Sheets.Count
If Not ComboBox1.Text = Sheets(i).Name Then
Sheets(i).Visible = xlSheetVeryHidden
End If
Next
i = i + 1
End If
Exit Sub
ErrHandler:
MsgBox "name is wrong"
Resume Next
End Sub
Private Sub UserForm_Activate()
For Each i In Worksheets
ComboBox1.AddItem (i.Name)
Next
i = i + 1
For i = 1 To Sheets.Count
Sheets(i).Visible = xlSheetVisible
Next
End Sub
thanks