im trying write code locks current worksheet random word changes each time use macro.
so far have:
sub protect() ' ' protect macro ' dim strpassword string activesheet.protect drawingobjects:=true, contents:=true, scenarios:=true strpassword = "hello" end sub
however doesn't lock spreadsheet password "hello" rather locks , unlocked clicking "unprotect sheet". i'd advance not lock "hello" rather lock random word.
create function make random "words"
function randomword() string dim long, ret string i=1 8 '8 characters length ret=ret & chr(rnd*(asc("z")-asc("a")+1)+asc("a")-1) next randomword=ret end function
so can use
activesheet.protect drawingobjects:=true, contents:=true, scenarios:=true, password:=randomword
now, why hell protect sheet random passwords???
Comments
Post a Comment