ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   protect cells (https://www.excelbanter.com/excel-programming/306905-protect-cells.html)

JT[_2_]

protect cells
 
I have a macro that creates subtotals. I want to protect
several cells to the right of the subtotal so the user can
be prevented from entering any data in them.

I'm looking for suggestions how to accomplish this.
Thanks.

Frank Kabel

protect cells
 
Hi
- select all cells
- goto 'Format - Cells - Protection' and uncheck 'Locked'

Now in your macro:
- set the .locked property of these cells to 'True'
- protect the sheet (e.g. activesheet.protect)



--
Regards
Frank Kabel
Frankfurt, Germany

"JT" schrieb im Newsbeitrag
...
I have a macro that creates subtotals. I want to protect
several cells to the right of the subtotal so the user can
be prevented from entering any data in them.

I'm looking for suggestions how to accomplish this.
Thanks.



Tom Ogilvy

protect cells
 
ActiveSheet.Unprotect
Cells.Locked = False
for each cell in Range("B4:B800")
if instr(1,cell.Text,"Subtotal",vbTextCompare) 0 then
cell.offset(0,1).Resize(1,10).Locked = True
end if
Next
Activesheet.Protect

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I have a macro that creates subtotals. I want to protect
several cells to the right of the subtotal so the user can
be prevented from entering any data in them.

I'm looking for suggestions how to accomplish this.
Thanks.




M

protect cells
 
Lock the entire sheet, then Unlock the cells you want
people to be able to enter information into then protect
the sheet. This will allow the user to only enter data in
cells you want them to use.

-----Original Message-----
I have a macro that creates subtotals. I want to protect
several cells to the right of the subtotal so the user

can
be prevented from entering any data in them.

I'm looking for suggestions how to accomplish this.
Thanks.
.



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

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