ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protection & Macros (https://www.excelbanter.com/excel-programming/300720-protection-macros.html)

Catherine[_5_]

Protection & Macros
 
How can I protect cells within my worksheets allowing
macros to enter data into them but not users???

Thanks in advance.

Catherine.


Norman Harker

Protection & Macros
 
Hi Catherine!

You need to insert code into your macros:

For j = 1 To Worksheets.Count
Worksheets(j).UnProtect Password:="not4u2see"
Next j

<your code that enters data

For j = 1 To Worksheets.Count
Worksheets(j).Protect Password:="not4u2see"
Next j



The above allows entry of data into any of the sheets assuming all use
the same password. Modify for a single sheet with data entry or where
you use different passwords for different sheets.


--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

"Catherine" wrote in message
...
How can I protect cells within my worksheets allowing
macros to enter data into them but not users???

Thanks in advance.

Catherine.




Dennis

Protection & Macros
 
Alternatively, set the UserInterFaceOnly argument to true
eg
Worksheets("Sheet1").Protect password:="password"
UserInterFaceOnly:= True

-----Original Message-----
Hi Catherine!

You need to insert code into your macros:

For j = 1 To Worksheets.Count
Worksheets(j).UnProtect Password:="not4u2see"
Next j

<your code that enters data

For j = 1 To Worksheets.Count
Worksheets(j).Protect Password:="not4u2see"
Next j



The above allows entry of data into any of the sheets

assuming all use
the same password. Modify for a single sheet with data

entry or where
you use different passwords for different sheets.


--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

"Catherine" wrote

in message
...
How can I protect cells within my worksheets allowing
macros to enter data into them but not users???

Thanks in advance.

Catherine.



.


Charles

Protection & Macros
 
Hi,

Usee the ActiveSheet.Unprotect "david"<< your password
At the begining of the Macro and when macro is done reset th
password.
ActiveSheet.Protect Password:="david"<<<< your password.


HTH Charle

--
Message posted from http://www.ExcelForum.com


Martyn

Protection & Macros
 
Hi Norman,
But can we prevent users not to "see" the password from the macro code?
TIA

"Norman Harker" wrote in message
...
Hi Catherine!

You need to insert code into your macros:

For j = 1 To Worksheets.Count
Worksheets(j).UnProtect Password:="not4u2see"
Next j

<your code that enters data

For j = 1 To Worksheets.Count
Worksheets(j).Protect Password:="not4u2see"
Next j



The above allows entry of data into any of the sheets assuming all use
the same password. Modify for a single sheet with data entry or where
you use different passwords for different sheets.


--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

"Catherine" wrote in message
...
How can I protect cells within my worksheets allowing
macros to enter data into them but not users???

Thanks in advance.

Catherine.





---
Outgoing mail is certified Virus Free.
(Giden posta virüssüz olarak belgelendi.)
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.703 / Virus Database: 459 - Release Date: 10.06.2004



Norman Harker

Protection & Macros
 
Hi Martyn!

Protect the Macro code. It's under the Tools menu in VBA.



--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

"Martyn" wrote in message
...
Hi Norman,
But can we prevent users not to "see" the password from the macro
code?
TIA

"Norman Harker" wrote in message
...
Hi Catherine!

You need to insert code into your macros:

For j = 1 To Worksheets.Count
Worksheets(j).UnProtect Password:="not4u2see"
Next j

<your code that enters data

For j = 1 To Worksheets.Count
Worksheets(j).Protect Password:="not4u2see"
Next j



The above allows entry of data into any of the sheets assuming all
use
the same password. Modify for a single sheet with data entry or
where
you use different passwords for different sheets.


--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

"Catherine" wrote in message
...
How can I protect cells within my worksheets allowing
macros to enter data into them but not users???

Thanks in advance.

Catherine.





---
Outgoing mail is certified Virus Free.
(Giden posta virüssüz olarak belgelendi.)
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.703 / Virus Database: 459 - Release Date: 10.06.2004





Martyn

Protection & Macros
 
I already know that...but thank you anyway.
Best wishes
Martyn


"Norman Harker" wrote in message
...
Hi Martyn!

Protect the Macro code. It's under the Tools menu in VBA.



--
Regards
Norman Harker MVP (Excel)
Sydney, Australia




---
Outgoing mail is certified Virus Free.
(Giden posta virüssüz olarak belgelendi.)
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.703 / Virus Database: 459 - Release Date: 10.06.2004


---
Outgoing mail is certified Virus Free.
(Giden posta virüssüz olarak belgelendi.)
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.703 / Virus Database: 459 - Release Date: 10.06.2004




All times are GMT +1. The time now is 11:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com