ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Locking Specific Cells (https://www.excelbanter.com/excel-programming/354745-locking-specific-cells.html)

[email protected][_2_]

Locking Specific Cells
 
Hey i have an interesting situation. I need certain cells in my file
to be protected while others are manipulated. Now normally we would do
this by going in to the cell formatting and clicking the lock cell
button then protecting the file. However, this doesn't work for my
situation. The reason is because I have a macro running in the back of
the program that is running so that when data is imported in these
cells the column width adjusts to the right size. I cannot remove this
feature because it needs to fit on one page....all i am looking for is
a way to lock a range of cells from text editing. Any help?


Tom Ogilvy

Locking Specific Cells
 
look at the UserInterFaceOnly property of the protect method (in Excel vba
help). This must be set each time the workbook is opened and must be set
with code. Then your code can work while the sheet remains protected.

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hey i have an interesting situation. I need certain cells in my file
to be protected while others are manipulated. Now normally we would do
this by going in to the cell formatting and clicking the lock cell
button then protecting the file. However, this doesn't work for my
situation. The reason is because I have a macro running in the back of
the program that is running so that when data is imported in these
cells the column width adjusts to the right size. I cannot remove this
feature because it needs to fit on one page....all i am looking for is
a way to lock a range of cells from text editing. Any help?




Tom Ogilvy

Locking Specific Cells
 
Of course another option is to have your code unprotect the sheet, set the
column width, protect the sheet.

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hey i have an interesting situation. I need certain cells in my file
to be protected while others are manipulated. Now normally we would do
this by going in to the cell formatting and clicking the lock cell
button then protecting the file. However, this doesn't work for my
situation. The reason is because I have a macro running in the back of
the program that is running so that when data is imported in these
cells the column width adjusts to the right size. I cannot remove this
feature because it needs to fit on one page....all i am looking for is
a way to lock a range of cells from text editing. Any help?




ME @ Home

Locking Specific Cells
 
you could use text validation on the cells you do not want entered and set it
not allow entrys more than 0 characters

or put in your macro ,,,,

password.unprotect
to unprotect the sheet whilst the macro is running
and password.protect
at the end of your macro to re protect your sheet

" wrote:

Hey i have an interesting situation. I need certain cells in my file
to be protected while others are manipulated. Now normally we would do
this by going in to the cell formatting and clicking the lock cell
button then protecting the file. However, this doesn't work for my
situation. The reason is because I have a macro running in the back of
the program that is running so that when data is imported in these
cells the column width adjusts to the right size. I cannot remove this
feature because it needs to fit on one page....all i am looking for is
a way to lock a range of cells from text editing. Any help?




All times are GMT +1. The time now is 05:08 PM.

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