ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide/lock cells? (https://www.excelbanter.com/excel-programming/358886-hide-lock-cells.html)

David

Hide/lock cells?
 
Hello,
I know that range of rows or columns can be hidden or locked.
How about specific cells? what is the syntax for that.

Thanks for your help

Tom Ogilvy

Hide/lock cells?
 
Not in the same sense as a row or a column. You can hide the formula in a
cell by using
Selection.FormulaHidden = True
but the value it calculates will be displayed. You set this property of the
range as shown, then you must protect the sheet.

Otherwise, hide the entirerow or column.

--
Regards,
Tom Ogilvy


"David" wrote:

Hello,
I know that range of rows or columns can be hidden or locked.
How about specific cells? what is the syntax for that.

Thanks for your help


Bob Phillips[_6_]

Hide/lock cells?
 
Individual cells can be locked though.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
Not in the same sense as a row or a column. You can hide the formula in a
cell by using
Selection.FormulaHidden = True
but the value it calculates will be displayed. You set this property of

the
range as shown, then you must protect the sheet.

Otherwise, hide the entirerow or column.

--
Regards,
Tom Ogilvy


"David" wrote:

Hello,
I know that range of rows or columns can be hidden or locked.
How about specific cells? what is the syntax for that.

Thanks for your help




Tom Ogilvy

Hide/lock cells?
 
Yes, guess I focused on the "Hide" portion and ignored the "Lock" portion.

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

Individual cells can be locked though.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
Not in the same sense as a row or a column. You can hide the formula in a
cell by using
Selection.FormulaHidden = True
but the value it calculates will be displayed. You set this property of

the
range as shown, then you must protect the sheet.

Otherwise, hide the entirerow or column.

--
Regards,
Tom Ogilvy


"David" wrote:

Hello,
I know that range of rows or columns can be hidden or locked.
How about specific cells? what is the syntax for that.

Thanks for your help





David

Hide/lock cells?
 
so I can do something like this:
---------
Cells(x,y).select
selection.FormulaHidden = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
-------------
Is this the code to lock cells:
cells(x,y).Locked = True
--------------
Another related question. For the code below
Columns("AT:IV").Hidden = True '??How can I use numbers for columns instead
of AT and IV? do I need to use cells.

Rows("44:65536").Hidden = True ' I used a variable row= 1, col = 44 and when
I tried:
Rows("row:col"), this would not work. Do you have any input on this

Thanks for your help

"Tom Ogilvy" wrote:

Yes, guess I focused on the "Hide" portion and ignored the "Lock" portion.

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

Individual cells can be locked though.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
Not in the same sense as a row or a column. You can hide the formula in a
cell by using
Selection.FormulaHidden = True
but the value it calculates will be displayed. You set this property of

the
range as shown, then you must protect the sheet.

Otherwise, hide the entirerow or column.

--
Regards,
Tom Ogilvy


"David" wrote:

Hello,
I know that range of rows or columns can be hidden or locked.
How about specific cells? what is the syntax for that.

Thanks for your help





Tom Ogilvy

Hide/lock cells?
 
With Cells(x,y)
.FormulaHidden = True
.Locked = True
End with
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

columns(46).Resize(,256-46+1)

testing in the immediate window (to demonstrate)
? columns(46).Resize(,256-46+1).address
$AT:$IV

or
Cells(1,46).Resize(1,256-46+1).EntireColumn

I would avoid useing terms used by excel, such as "row" which is a propertie
name.

Range(rw & ":" & col)

Testing in the immediate window: (to demonstrate)
rw = 44
col = 65536
? Range(rw & ":" & col).Address
$44:$65536

--
Regards,
Tom Ogilvy


"David" wrote:

so I can do something like this:
---------
Cells(x,y).select
selection.FormulaHidden = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
-------------
Is this the code to lock cells:
cells(x,y).Locked = True
--------------
Another related question. For the code below
Columns("AT:IV").Hidden = True '??How can I use numbers for columns instead
of AT and IV? do I need to use cells.

Rows("44:65536").Hidden = True ' I used a variable row= 1, col = 44 and when
I tried:
Rows("row:col"), this would not work. Do you have any input on this

Thanks for your help

"Tom Ogilvy" wrote:

Yes, guess I focused on the "Hide" portion and ignored the "Lock" portion.

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

Individual cells can be locked though.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
Not in the same sense as a row or a column. You can hide the formula in a
cell by using
Selection.FormulaHidden = True
but the value it calculates will be displayed. You set this property of
the
range as shown, then you must protect the sheet.

Otherwise, hide the entirerow or column.

--
Regards,
Tom Ogilvy


"David" wrote:

Hello,
I know that range of rows or columns can be hidden or locked.
How about specific cells? what is the syntax for that.

Thanks for your help




David

Hide/lock cells?
 
Thanks Tom,
I will give this a try.

Apprreciate your help

"Tom Ogilvy" wrote:

With Cells(x,y)
.FormulaHidden = True
.Locked = True
End with
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

columns(46).Resize(,256-46+1)

testing in the immediate window (to demonstrate)
? columns(46).Resize(,256-46+1).address
$AT:$IV

or
Cells(1,46).Resize(1,256-46+1).EntireColumn

I would avoid useing terms used by excel, such as "row" which is a propertie
name.

Range(rw & ":" & col)

Testing in the immediate window: (to demonstrate)
rw = 44
col = 65536
? Range(rw & ":" & col).Address
$44:$65536

--
Regards,
Tom Ogilvy


"David" wrote:

so I can do something like this:
---------
Cells(x,y).select
selection.FormulaHidden = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
-------------
Is this the code to lock cells:
cells(x,y).Locked = True
--------------
Another related question. For the code below
Columns("AT:IV").Hidden = True '??How can I use numbers for columns instead
of AT and IV? do I need to use cells.

Rows("44:65536").Hidden = True ' I used a variable row= 1, col = 44 and when
I tried:
Rows("row:col"), this would not work. Do you have any input on this

Thanks for your help

"Tom Ogilvy" wrote:

Yes, guess I focused on the "Hide" portion and ignored the "Lock" portion.

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

Individual cells can be locked though.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
Not in the same sense as a row or a column. You can hide the formula in a
cell by using
Selection.FormulaHidden = True
but the value it calculates will be displayed. You set this property of
the
range as shown, then you must protect the sheet.

Otherwise, hide the entirerow or column.

--
Regards,
Tom Ogilvy


"David" wrote:

Hello,
I know that range of rows or columns can be hidden or locked.
How about specific cells? what is the syntax for that.

Thanks for your help




David

Hide/lock cells?
 
Hi tom, sorry I am little bit new to excel/VB

I understand the following code:
-------
With Cells(x,y)
.FormulaHidden = True
.Locked = True
End with
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
------------------
Can you please explain what is this other code doing
Is the "?" included in the code
---------------------------
rw = 44
col = 65536
? Range(rw & ":" & col).Address
$44:$65536

-------------------------------

Is the code below changing the size of specific cells?
Cells(1,46).Resize(1,256-46+1).EntireColumn

"256-46+1" ??

Thanks for your help


"David" wrote:

Thanks Tom,
I will give this a try.

Apprreciate your help

"Tom Ogilvy" wrote:

With Cells(x,y)
.FormulaHidden = True
.Locked = True
End with
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

columns(46).Resize(,256-46+1)

testing in the immediate window (to demonstrate)
? columns(46).Resize(,256-46+1).address
$AT:$IV

or
Cells(1,46).Resize(1,256-46+1).EntireColumn

I would avoid useing terms used by excel, such as "row" which is a propertie
name.

Range(rw & ":" & col)

Testing in the immediate window: (to demonstrate)
rw = 44
col = 65536
? Range(rw & ":" & col).Address
$44:$65536

--
Regards,
Tom Ogilvy


"David" wrote:

so I can do something like this:
---------
Cells(x,y).select
selection.FormulaHidden = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
-------------
Is this the code to lock cells:
cells(x,y).Locked = True
--------------
Another related question. For the code below
Columns("AT:IV").Hidden = True '??How can I use numbers for columns instead
of AT and IV? do I need to use cells.

Rows("44:65536").Hidden = True ' I used a variable row= 1, col = 44 and when
I tried:
Rows("row:col"), this would not work. Do you have any input on this

Thanks for your help

"Tom Ogilvy" wrote:

Yes, guess I focused on the "Hide" portion and ignored the "Lock" portion.

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

Individual cells can be locked though.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
Not in the same sense as a row or a column. You can hide the formula in a
cell by using
Selection.FormulaHidden = True
but the value it calculates will be displayed. You set this property of
the
range as shown, then you must protect the sheet.

Otherwise, hide the entirerow or column.

--
Regards,
Tom Ogilvy


"David" wrote:

Hello,
I know that range of rows or columns can be hidden or locked.
How about specific cells? what is the syntax for that.

Thanks for your help





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

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