ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Lock Header Rows from Editing (https://www.excelbanter.com/excel-programming/345361-lock-header-rows-editing.html)

HotRod

Lock Header Rows from Editing
 
IS there a way, either in VBA or just excel to lock the header rows (Rows
1 -3) so that they can not be Edited or deleted?



Chip Pearson

Lock Header Rows from Editing
 
Select all the cells in your worksheet, go to the Format menu,
choose Cells, then the Protection tab. There, uncheck the Locked
property and click OK. Now select rows 1:3, go back to the
Protection tab, check the Protection tab, and click OK. Finally,
go to the Tools menu, choose Protection, and Protect Sheet.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"HotRod" wrote in message
...
IS there a way, either in VBA or just excel to lock the header
rows (Rows 1 -3) so that they can not be Edited or deleted?




HotRod

Lock Header Rows from Editing
 
I found that when I did this some of my VBA code was not working properly,
specifically trying to change the interior ROW colour.



"Chip Pearson" wrote in message
...
Select all the cells in your worksheet, go to the Format menu, choose
Cells, then the Protection tab. There, uncheck the Locked property and
click OK. Now select rows 1:3, go back to the Protection tab, check the
Protection tab, and click OK. Finally, go to the Tools menu, choose
Protection, and Protect Sheet.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"HotRod" wrote in message
...
IS there a way, either in VBA or just excel to lock the header rows (Rows
1 -3) so that they can not be Edited or deleted?






Jason Clement

Lock Header Rows from Editing
 
You can protect your sheet to do this. However, cells are locked by default
so you need to highlight the entire sheet except for the first three rows
(you can do this by highlighting the fourth row and pressing ctrl+shift+down)
and uncheck locked on the protection tab of cell properties. You can protect
the sheet by accessing Tools-Protection-Protect Sheet from the menu.
You'll get a dialog showing all the available options, and you can add a
password which has to be entered to unlock the sheet. You should note,
however, that if you prevent users from deleting rows (to protect the first
three), they won't be able to delete any rows in the sheet.

"HotRod" wrote:

IS there a way, either in VBA or just excel to lock the header rows (Rows
1 -3) so that they can not be Edited or deleted?




HotRod

Lock Header Rows from Editing
 
What I did was highlight the whole sheet and "Unlocked" it then I
highlighted the first three rows and "Locked" them, finally I protected the
whole workbook. However when I ran my VBA macro it will not allow me to
change the interior colour of a row. As soon as I unlock the sheet
everything is fine.



Dave Peterson

Lock Header Rows from Editing
 
You can modify your code to unprotect the worksheet, make the changes, then
reprotect the worksheet.

HotRod wrote:

I found that when I did this some of my VBA code was not working properly,
specifically trying to change the interior ROW colour.

"Chip Pearson" wrote in message
...
Select all the cells in your worksheet, go to the Format menu, choose
Cells, then the Protection tab. There, uncheck the Locked property and
click OK. Now select rows 1:3, go back to the Protection tab, check the
Protection tab, and click OK. Finally, go to the Tools menu, choose
Protection, and Protect Sheet.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"HotRod" wrote in message
...
IS there a way, either in VBA or just excel to lock the header rows (Rows
1 -3) so that they can not be Edited or deleted?




--

Dave Peterson

HotRod

Lock Header Rows from Editing
 
Any chance you have an example of this code to Protect and Unprotect the
sheet???



"Dave Peterson" wrote in message
...
You can modify your code to unprotect the worksheet, make the changes,
then
reprotect the worksheet.

HotRod wrote:

I found that when I did this some of my VBA code was not working
properly,
specifically trying to change the interior ROW colour.

"Chip Pearson" wrote in message
...
Select all the cells in your worksheet, go to the Format menu, choose
Cells, then the Protection tab. There, uncheck the Locked property and
click OK. Now select rows 1:3, go back to the Protection tab, check the
Protection tab, and click OK. Finally, go to the Tools menu, choose
Protection, and Protect Sheet.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"HotRod" wrote in message
...
IS there a way, either in VBA or just excel to lock the header rows
(Rows
1 -3) so that they can not be Edited or deleted?




--

Dave Peterson




Dave Peterson

Lock Header Rows from Editing
 
Option explicit
sub testme()
with worksheets("Sheet99")
.unprotect password:="topsecret"
'do your formatting
.protect password:="topsecret"
end with
end sub



HotRod wrote:

Any chance you have an example of this code to Protect and Unprotect the
sheet???

"Dave Peterson" wrote in message
...
You can modify your code to unprotect the worksheet, make the changes,
then
reprotect the worksheet.

HotRod wrote:

I found that when I did this some of my VBA code was not working
properly,
specifically trying to change the interior ROW colour.

"Chip Pearson" wrote in message
...
Select all the cells in your worksheet, go to the Format menu, choose
Cells, then the Protection tab. There, uncheck the Locked property and
click OK. Now select rows 1:3, go back to the Protection tab, check the
Protection tab, and click OK. Finally, go to the Tools menu, choose
Protection, and Protect Sheet.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"HotRod" wrote in message
...
IS there a way, either in VBA or just excel to lock the header rows
(Rows
1 -3) so that they can not be Edited or deleted?




--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 02:31 PM.

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