ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macros (https://www.excelbanter.com/excel-programming/407022-macros.html)

Liz

Macros
 
Hi I am trying to set up protection in a worksheet for certain columns only.
On blank rows I would like to add information in those protected columns is
this possible to do with out entering a password. Would I have to create a
Macro for this set up if so how would I go about this. Thanks for any help
you can give me.

LeShark

Macros
 
a few assumptions here...

the protected data is contiguous - i.e. the blank rows come at the end not
in between.. if this is the case then the following will help

insert a range like below. the example uses Sheet1 and the protected columns
will be H & I & J. This range expands as data is inserted into column H.

=OFFSET(Sheet1!$H$1,0,0,COUNTA(Sheet1!$H:$H),3)

unprotect all the cells on the sheet

give the sheet a password - in the example it is "mypassword"

insert the following code in a module - it runs each time the sheet is
opened and protects all the data in the range - in this case data in columns
H, I and J
the rows below the last entry in column H are unprotected.


sub Auto_Open ( )
ActiveSheet.unprotect Password:="mypassword"
Range("myrange").Select
Selection.Locked = True
ActiveSheet.protect Password:="mypassword"
end sub

have fun...



"Liz" wrote:

Hi I am trying to set up protection in a worksheet for certain columns only.
On blank rows I would like to add information in those protected columns is
this possible to do with out entering a password. Would I have to create a
Macro for this set up if so how would I go about this. Thanks for any help
you can give me.



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

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