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!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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
 
Upvote 0
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?
 
Upvote 0
Hey thanks!

That worked great.

Thank you so much.

Any advice as to where a beginner can learn VBA?
 
Upvote 0
Also, is there a way to change the "title" of the message box from "Microsoft Excel" to something else?

Thanks!
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,384
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top