Macros

  • Thread starter Thread starter Liz
  • Start date Start date
L

Liz

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.
 
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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top