Simple Code to open multiple hidden worksheets

gstullo

New Member
Joined
Sep 29, 2009
Messages
17
Hello,

Very new to VBA. Working off a code that hides worksheets until a password given to open them.

I want to modify this so that it will open more than one sheet...

What I have:

Option Compare Text
Const pWord2 = "XXX"


Sub showsheets2()
Select Case InputBox("Enter Raw Data Password")

Case Is = pWord2
With Worksheets("Raw Data Dashboard")
.Visible = xlSheetVisible


End With
Case Else
MsgBox "Nope! Please enter correct password to see raw data"
End Select

End Sub

How do I make it so another sheet opens at the same time?

Thanks!
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Code:
Sub showsheets2()
rspn = InputBox("Enter Raw Data Password")
Select Case rspn
Case  "password"
Worksheets("Raw Data Dashboard").Visible = xlSheetVisible
WorkSheets("whatever").Visible = xlSheetVisible 
Case Else
MsgBox "Nope! Please enter correct password to see raw data"
End Select
End Sub
lenze
 

gstullo

New Member
Joined
Sep 29, 2009
Messages
17
Code:
Sub showsheets2()
rspn = InputBox("Enter Raw Data Password")
Select Case rspn
Case  "password"
Worksheets("Raw Data Dashboard").Visible = xlSheetVisible
WorkSheets("whatever").Visible = xlSheetVisible 
Case Else
MsgBox "Nope! Please enter correct password to see raw data"
End Select
End Sub
lenze
What?
 

gstullo

New Member
Joined
Sep 29, 2009
Messages
17
Hey thanks!

That worked great.

Thank you so much.

Any advice as to where a beginner can learn VBA?
 

gstullo

New Member
Joined
Sep 29, 2009
Messages
17
Also, is there a way to change the "title" of the message box from "Microsoft Excel" to something else?

Thanks!
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Any advice as to where a beginner can learn VBA?
1 Try recording macros and look at the code The Macro Recorder is your friend!!
2 Check out the books at MrExcel.com
3 Visit the board regularly, paying attention to code posted by senior members.
4 Try to modify, on your own, posted code that may have an application for you.

lenze
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
The MsgBox title is the 3rd argument of the MsgBox Statement
Code:
MsgBox "Nope! Please enter correct password to see raw data", vbOK,"Opps"
lenze
 

Forum statistics

Threads
1,081,415
Messages
5,358,527
Members
400,501
Latest member
price83

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top