Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 79
Default Password in Visual basic editor

Hi

I have a workbook for time sheet and i have used the following code so
i can be able to have the first sheet always displayed and whenever
you click on the name the concerned sheet will open
what i need now is the following:
1.what is the way that whenever you click on a name to open you will
have a password protection for each sheet so only the sheet user can
open his sheet that will be protected by a password the main sheet
should be non protected only the the other sheets and what can i do to
stop all the codes and the password so i can udjust info each month ?

2. can i put it on share even thow its protected or whenever i put it
on share no password would be prompt ?

The code that im using is the following : Workbook code
Private Sub Workbook_Open()
Dim ws As Worksheet
Sheets("Main").Select
If Range("D1").Value = "Tia" Then
For Each ws In ThisWorkbook.Worksheets
ws.Visible = True
Next ws
End If
End Sub


Sheet Main

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim ws As Worksheet
Dim RngOfNames As Range
If Target.Count 1 Then Exit Sub
If Range("D1").Value = "Tia" Then Exit Sub
Set RngOfNames = Union(Range("A12:A46"), Range("F12:F46"))
Application.ScreenUpdating = False
If Not Intersect(Target, RngOfNames) Is Nothing Then
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Main" Then ws.Visible = False
Next ws
On Error GoTo NoSht
Sheets(CStr(Target.Value)).Visible = True
Sheets(CStr(Target.Value)).Select
End If
Application.ScreenUpdating = True
Exit Sub
NoSht:
On Error GoTo 0
MsgBox "There is no sheet named " & Target.Value & ".", 16,
"Invalid Sheet Name"
End Sub




Tia
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
Visual Basic Editor - Time and Date Entry Continued Tammy Excel Worksheet Functions 2 January 4th 08 03:49 PM
Visual Basic Editor opens bi itself KG Excel Discussion (Misc queries) 0 September 15th 07 04:02 PM
Printing with Visual Basic Editor Problem Meader Excel Discussion (Misc queries) 3 May 30th 07 08:55 PM
Visual basic editor Answerfactory Excel Discussion (Misc queries) 3 October 9th 06 09:13 PM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM


All times are GMT +1. The time now is 07:12 PM.

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"