inputbox password error

sassriverrat

Well-known Member
Joined
Oct 4, 2018
Messages
655
Good Afternoon,

I have an input box that shows a veryhidden sheet. I'm trying to use Cell B23 on Developer sheet as the password (so the password can be easily changed). This code worked perfectly when the password was just typed in the coding itself but now trying to reference the developer sheet it isn't working. Ideas?

Rich (BB code):
Private Sub CommandButton2_Click()mypass = Application.InputBox("Enter Password", "The Coding Sheets")
If mypass = Worksheets("Developer").Range("B23:E23").Value Then
    Sheets("Developer").Visible = True
    Sheets("Developer").Select
    Sheets("Notes").Visible = True
    Application.Visible = True
End If
Unload Me
End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
try
Code:
If mypass = Worksheets("Developer").Range("B23").Value Then
 
Upvote 0
Hmmm. Didn’t work. The input box goes away after entering and nothing happens (as if I put the wrong password in). I was using 1234567890 as the password.
 
Upvote 0
Try
Code:
If mypass = CStr(Worksheets("Developer").Range("B23").Value) Then
 
Upvote 0
The InputBox returns a string rather than a number, so Peter's code converts the cell value to a string in order to compare it to the "mypass" value
 
Upvote 0
Ahhh that makes sense. Thanks guys!

I've almost got my project "error proof" for the users!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,157
Messages
6,170,418
Members
452,325
Latest member
BlahQz

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