tags:

views:

17

answers:

0

Hi All, I have an excel sheet which as a lot of fields to enter data in. Let's say the total fields I have is 20. Ten of them are locked by default whenever the user opens the workbook. Now, one of the fields is asking the user to enter a password. If the password was "AAA", then five fields (of the Ten locked ones) will be unlocked and can be eddited. If the user inputs a password as "BBB" , then All the cells of the worksheet will be read-only and locked to prevent editting. I am focusing on the case when the user inputs "BBB". I tried this code but did not work:

if Range("Password").value="BBB" then
 cells.select
 selection.locked=true
end if

it gives me an error as " Overflow" please help.