Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Storing value in a variable from a cell

hi I am try to make password protected workseets. every worksheet has its own
password, stroed in a sheet named "HiddenPass". The problem is that how can I
pick the value of Cell D4 of Sheet "HiddenPass" when I click on sheet
"Biodata". I am using "UserPass" as variable in Activate event of workseet
"Biodata".

The code I am using (but not worked)

UserPass = Sheets("Biodata").Cells(4, 4).Value


anyone could help.

Saadi
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Storing value in a variable from a cell

Try

UserPass = Sheets("HiddenPass").Cells(4, 4).Value

or

UserPass = Sheets("HiddenPass").range("D4").Value


--
HTH

-------

Bob Phillips
"Saadi" wrote in message
...
hi I am try to make password protected workseets. every worksheet has its

own
password, stroed in a sheet named "HiddenPass". The problem is that how

can I
pick the value of Cell D4 of Sheet "HiddenPass" when I click on sheet
"Biodata". I am using "UserPass" as variable in Activate event of workseet
"Biodata".

The code I am using (but not worked)

UserPass = Sheets("Biodata").Cells(4, 4).Value


anyone could help.

Saadi



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Storing value in a variable from a cell

It worked, the complete code is given below for others. But there is still a
problem. While it works correctly, but the Activate Event displays the
contants of the sheet , when the Inputbox asks the password from the user.
How do I do, that no one can see the contents of Sheet without entering the
Password.

The code is,

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Pass = Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
End If
End Sub



"Bob Phillips" wrote:

Try

UserPass = Sheets("HiddenPass").Cells(4, 4).Value

or

UserPass = Sheets("HiddenPass").range("D4").Value


--
HTH

-------

Bob Phillips
"Saadi" wrote in message
...
hi I am try to make password protected workseets. every worksheet has its

own
password, stroed in a sheet named "HiddenPass". The problem is that how

can I
pick the value of Cell D4 of Sheet "HiddenPass" when I click on sheet
"Biodata". I am using "UserPass" as variable in Activate event of workseet
"Biodata".

The code I am using (but not worked)

UserPass = Sheets("Biodata").Cells(4, 4).Value


anyone could help.

Saadi




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Storing value in a variable from a cell

Saadi,

Hide the sheet. Go into the VBE and make it very hidden, by typing

Worksheets("sheet_name").Visible = xlSheetVeryHidden

and then use this code in the worksheet code module

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Pass = "ABC" 'Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox ("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
Else
Me.Visible = xlSheetVisible
End If
End Sub

Private Sub Worksheet_Deactivate()
Me.Visible = xlSheetVeryHidden
End Sub


HTH

RP
(remove nothere from the email address if mailing direct)


"Saadi" wrote in message
...
It worked, the complete code is given below for others. But there is still

a
problem. While it works correctly, but the Activate Event displays the
contants of the sheet , when the Inputbox asks the password from the user.
How do I do, that no one can see the contents of Sheet without entering

the
Password.

The code is,

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Pass = Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
End If
End Sub



"Bob Phillips" wrote:

Try

UserPass = Sheets("HiddenPass").Cells(4, 4).Value

or

UserPass = Sheets("HiddenPass").range("D4").Value


--
HTH

-------

Bob Phillips
"Saadi" wrote in message
...
hi I am try to make password protected workseets. every worksheet has

its
own
password, stroed in a sheet named "HiddenPass". The problem is that

how
can I
pick the value of Cell D4 of Sheet "HiddenPass" when I click on sheet
"Biodata". I am using "UserPass" as variable in Activate event of

workseet
"Biodata".

The code I am using (but not worked)

UserPass = Sheets("Biodata").Cells(4, 4).Value


anyone could help.

Saadi






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Storing value in a variable from a cell

I got your point but there is still confusion, if a sheet is in hidden mode,
then how could it be clicked for activation to blast the event Activate. And
also the Worksheets(€śPasswords€ť).Visible = xlSheetVeryHidden code where will
be placed ?

"Bob Phillips" wrote:

Saadi,

Hide the sheet. Go into the VBE and make it very hidden, by typing

Worksheets("sheet_name").Visible = xlSheetVeryHidden

and then use this code in the worksheet code module

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Pass = "ABC" 'Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox ("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
Else
Me.Visible = xlSheetVisible
End If
End Sub

Private Sub Worksheet_Deactivate()
Me.Visible = xlSheetVeryHidden
End Sub


HTH

RP
(remove nothere from the email address if mailing direct)


"Saadi" wrote in message
...
It worked, the complete code is given below for others. But there is still

a
problem. While it works correctly, but the Activate Event displays the
contants of the sheet , when the Inputbox asks the password from the user.
How do I do, that no one can see the contents of Sheet without entering

the
Password.

The code is,

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Pass = Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
End If
End Sub



"Bob Phillips" wrote:

Try

UserPass = Sheets("HiddenPass").Cells(4, 4).Value

or

UserPass = Sheets("HiddenPass").range("D4").Value


--
HTH

-------

Bob Phillips
"Saadi" wrote in message
...
hi I am try to make password protected workseets. every worksheet has

its
own
password, stroed in a sheet named "HiddenPass". The problem is that

how
can I
pick the value of Cell D4 of Sheet "HiddenPass" when I click on sheet
"Biodata". I am using "UserPass" as variable in Activate event of

workseet
"Biodata".

The code I am using (but not worked)

UserPass = Sheets("Biodata").Cells(4, 4).Value


anyone could help.

Saadi








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Storing value in a variable from a cell

Good point :-).

How about this variation which hides it when clicked then unhides it, scrap
the deactivate event

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Me.Visible = xlSheetHidden
Pass = "ABC" 'Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox ("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
Else
Me.Visible = xlSheetVisible
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Saadi" wrote in message
...
I got your point but there is still confusion, if a sheet is in hidden

mode,
then how could it be clicked for activation to blast the event Activate.

And
also the Worksheets("Passwords").Visible = xlSheetVeryHidden code where

will
be placed ?

"Bob Phillips" wrote:

Saadi,

Hide the sheet. Go into the VBE and make it very hidden, by typing

Worksheets("sheet_name").Visible = xlSheetVeryHidden

and then use this code in the worksheet code module

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Pass = "ABC" 'Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox ("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
Else
Me.Visible = xlSheetVisible
End If
End Sub

Private Sub Worksheet_Deactivate()
Me.Visible = xlSheetVeryHidden
End Sub


HTH

RP
(remove nothere from the email address if mailing direct)


"Saadi" wrote in message
...
It worked, the complete code is given below for others. But there is

still
a
problem. While it works correctly, but the Activate Event displays the
contants of the sheet , when the Inputbox asks the password from the

user.
How do I do, that no one can see the contents of Sheet without

entering
the
Password.

The code is,

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Pass = Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
End If
End Sub



"Bob Phillips" wrote:

Try

UserPass = Sheets("HiddenPass").Cells(4, 4).Value

or

UserPass = Sheets("HiddenPass").range("D4").Value


--
HTH

-------

Bob Phillips
"Saadi" wrote in message
...
hi I am try to make password protected workseets. every worksheet

has
its
own
password, stroed in a sheet named "HiddenPass". The problem is

that
how
can I
pick the value of Cell D4 of Sheet "HiddenPass" when I click on

sheet
"Biodata". I am using "UserPass" as variable in Activate event of

workseet
"Biodata".

The code I am using (but not worked)

UserPass = Sheets("Biodata").Cells(4, 4).Value


anyone could help.

Saadi








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Storing value in a variable from a cell

A better variation

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Me.Visible = xlSheetHidden
Pass = Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < "" Then
If UPass < Pass Then
MsgBox ("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
Me.Visible = xlSheetVisible
Else
Application.EnableEvents = False
Me.Activate
Application.EnableEvents = True
Me.Visible = xlSheetVisible
End If
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bob Phillips" wrote in message
...
Good point :-).

How about this variation which hides it when clicked then unhides it,

scrap
the deactivate event

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Me.Visible = xlSheetHidden
Pass = "ABC" 'Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox ("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
Else
Me.Visible = xlSheetVisible
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Saadi" wrote in message
...
I got your point but there is still confusion, if a sheet is in hidden

mode,
then how could it be clicked for activation to blast the event Activate.

And
also the Worksheets("Passwords").Visible = xlSheetVeryHidden code where

will
be placed ?

"Bob Phillips" wrote:

Saadi,

Hide the sheet. Go into the VBE and make it very hidden, by typing

Worksheets("sheet_name").Visible = xlSheetVeryHidden

and then use this code in the worksheet code module

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Pass = "ABC" 'Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox ("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
Else
Me.Visible = xlSheetVisible
End If
End Sub

Private Sub Worksheet_Deactivate()
Me.Visible = xlSheetVeryHidden
End Sub


HTH

RP
(remove nothere from the email address if mailing direct)


"Saadi" wrote in message
...
It worked, the complete code is given below for others. But there is

still
a
problem. While it works correctly, but the Activate Event displays

the
contants of the sheet , when the Inputbox asks the password from the

user.
How do I do, that no one can see the contents of Sheet without

entering
the
Password.

The code is,

Private Sub Worksheet_Activate()
Dim Pass As String
Dim UPass As String
Pass = Sheets("Password").Range("A3").Value
UPass = InputBox("Enter Your Password")
If UPass < Pass Then
MsgBox("Your Password is Invalid")
Application.Sheets("Sheet1").Activate
End If
End Sub



"Bob Phillips" wrote:

Try

UserPass = Sheets("HiddenPass").Cells(4, 4).Value

or

UserPass = Sheets("HiddenPass").range("D4").Value


--
HTH

-------

Bob Phillips
"Saadi" wrote in message
...
hi I am try to make password protected workseets. every

worksheet
has
its
own
password, stroed in a sheet named "HiddenPass". The problem is

that
how
can I
pick the value of Cell D4 of Sheet "HiddenPass" when I click on

sheet
"Biodata". I am using "UserPass" as variable in Activate event

of
workseet
"Biodata".

The code I am using (but not worked)

UserPass = Sheets("Biodata").Cells(4, 4).Value


anyone could help.

Saadi










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing textin a variable and comparing to a second value Ron Excel Discussion (Misc queries) 3 May 13th 09 08:26 PM
Storing a range variable in a cell Dreaded404 Excel Discussion (Misc queries) 1 July 2nd 08 03:37 PM
Storing a value to variable CLamar Excel Discussion (Misc queries) 0 June 16th 06 04:46 PM
Storing a Macro name in a Variable Jack Adams Excel Programming 2 October 5th 04 03:59 PM
Excel VBA - Storing text in a variable, and "'Cells' of object _Global failed" engineer[_2_] Excel Programming 3 April 23rd 04 11:35 PM


All times are GMT +1. The time now is 09:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"