PDA

View Full Version : [SOLVED:] Obtaining password from worksheet range



streub
10-19-2013, 07:32 AM
I need to utilize the password "25624" located on sheet c, range I2 rather than having it included in the sub. I keep getting an error.


Private Sub CommandButton2_Click()
If TextBox2.Value = "25624" Then '<<<<<<<<
ComboBox1.Visible = True
TextBox1.Visible = True
CommandButton3.Visible = True
Range("h18").Value = "From"
Range("I18").Value = "To"
End If
If TextBox2.Value <> "25624" Then '<<<<<<<<
MsgBox "You Do Not Have Authorization"
ComboBox1.Value = ""
ComboBox1.Visible = False
TextBox1.Value = ""
TextBox1.Visible = False
TextBox2.Value = ""
CommandButton3.Visible = False
Range("h18:i18").ClearContents
End If
End Sub

snb
10-19-2013, 07:38 AM
is using TextBox2.Text = "25624" an option ?

streub
10-19-2013, 08:18 AM
You are omnipresent!

Of course it is an option; however, with the number of retail stores we have I would prefer to use the worksheet range. I plan to an "initial load" sub in the future that would allow each store to enter the sales staff and manager' passwords.

Paul_Hossler
10-19-2013, 06:35 PM
Not sure I understand, but possibly something like this



If TextBox2.Value = Worksheets("C").Range("I2").Text Then


Paul

streub
10-22-2013, 09:11 AM
I must have played with this for about an hour and thought I had used what you noe recommend but with no success. Executes perfectly. Thank you.




Not sure I understand, but possibly something like this



If TextBox2.Value = Worksheets("C").Range("I2").Text Then


Paul

Paul_Hossler
10-22-2013, 10:32 AM
As a note, I used .Text and not .Value

There can be a difference, since .Text uses the cell as displayed

Online help is pretty good

Paul