Hi all
I have a worksheet with a command button on it called cmdAddRow. Basically, it adds a row to the worksheet at a specified point. This point changes depending on how many rows of data are already in the sheet. e.g
row 1 £200.00
row 2 £175.99
total £275.99
So I want to add a row between row 2 and total row. I can do this OK, but once I put protection on the worksheet I get run time error 1004 when unprotecting the sheet...
I dont want the user adding values wherever they like, so I need to protect the sheet, unprotect it to add the row, unlock the cells the user can enter data into, then protect the sheet once again.
I have tried activeworkbooks.unprotect "password" and worksheets("sheet1".unprotect password:="password" and worksheets("sheet1".unprotect "password" and
Set myworksheet = Worksheets("cash payments"
myworksheet.Unprotect Password:="password"
to no avail.
Suprisingly enough, I can unlock the sheets no problem from VB5 which I use to import the data. I use xlSheet.Unprotect ("password" and this works np. I then protect it with xlSheet.Protect Password:="password"
HELP !!! Missy Ed
Looking to exchange ideas and tips on VB and MS Access development as well as office 97 development. Drop me a line: msedbbw@hotmail.com
I have a worksheet with a command button on it called cmdAddRow. Basically, it adds a row to the worksheet at a specified point. This point changes depending on how many rows of data are already in the sheet. e.g
row 1 £200.00
row 2 £175.99
total £275.99
So I want to add a row between row 2 and total row. I can do this OK, but once I put protection on the worksheet I get run time error 1004 when unprotecting the sheet...
I dont want the user adding values wherever they like, so I need to protect the sheet, unprotect it to add the row, unlock the cells the user can enter data into, then protect the sheet once again.
I have tried activeworkbooks.unprotect "password" and worksheets("sheet1".unprotect password:="password" and worksheets("sheet1".unprotect "password" and
Set myworksheet = Worksheets("cash payments"
myworksheet.Unprotect Password:="password"
to no avail.
Suprisingly enough, I can unlock the sheets no problem from VB5 which I use to import the data. I use xlSheet.Unprotect ("password" and this works np. I then protect it with xlSheet.Protect Password:="password"
HELP !!! Missy Ed
Looking to exchange ideas and tips on VB and MS Access development as well as office 97 development. Drop me a line: msedbbw@hotmail.com