View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Paul B
 
Posts: n/a
Default Using macro to un/protect sheet

Bonbon, how about something like this on the sheet so the user would have to
enter a password to edit

Sub PassWord_To_Edit()
'must lock VBA project so you can't see the password in it
Dim MyStr1 As String, MyStr2 As String
With ActiveSheet
MyStr2 = ("123") 'This is the password and it is CASE sensitive
MyStr1 = InputBox("Password Is Required To Add/Edit Data")
If MyStr1 = MyStr2 Then

'put your code here to add data

Else
MsgBox ("Access Denied")
End If
End With
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Bonbon" wrote in message
...
hi hi, thx agen for the previous helps =D
i searched this up to see if i could find nething b4 disturbing you nice

ppl
lol, but i still dont understand.
i want to make a button, which will allow the user to View the books n not
rewrite. And a button which allows the user to actually add/edit the data,
however this user would need to enter a password. i want both buttons to

open
the same workbook, but each with a different authority. I dont know how to
create like a message or box where the user has to enter a password to

gain
access in adding new data .
i've been thinkin long and hard but dont know where to start, can anyone
help me out? lol

thanks in advance =)