ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to make the content in an excel cell read only?! (https://www.excelbanter.com/excel-programming/422703-how-make-content-excel-cell-read-only.html)

NA_AB[_2_]

how to make the content in an excel cell read only?!
 


Simon Lloyd[_988_]

how to make the content in an excel cell read only?!
 

*how to make the content in an excel cell read only?!* Firstly you have to make sure the cells attributes are locked (right

click, format cells, protection) they are locked by default, then
protect the sheet, the cell can then only be read not edited. To be
honest you need to explain more what you want to do!


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=52319


NA_AB[_2_]

how to make the content in an excel cell read only?!
 
well, am actually working with c# and developing an excel addin. I need to
make some excel cells, having some text, read-only and the rest of the sheet
is free to any modifications by the user.

Regards.

"Simon Lloyd" wrote:


*how to make the content in an excel cell read only?!* Firstly you have to make sure the cells attributes are locked (right

click, format cells, protection) they are locked by default, then
protect the sheet, the cell can then only be read not edited. To be
honest you need to explain more what you want to do!


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=52319



Simon Lloyd[_989_]

how to make the content in an excel cell read only?!
 

The same applies!, either that or specifically name them in an intersect
range, and make it so that cell cannot be selected, but of course if you
are doing that macro's have to be enabled!

NA_AB;189924 Wrote:
well, am actually working with c# and developing an excel addin. I need
to
make some excel cells, having some text, read-only and the rest of the
sheet
is free to any modifications by the user.

Regards.

"Simon Lloyd" wrote:


*how to make the content in an excel cell read only?!* Firstly you

have to make sure the cells attributes are locked (right
click, format cells, protection) they are locked by default, then
protect the sheet, the cell can then only be read not edited. To be
honest you need to explain more what you want to do!


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' ('The Code Cage' (http://www.thecodecage.com))

------------------------------------------------------------------------
Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon

Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)
View this thread: 'how to make the content in an excel cell read

only?! - The Code Cage Forums'
(http://www.thecodecage.com/forumz/sh...ad.php?t=52319)




--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=52319


Simon Lloyd[_990_]

how to make the content in an excel cell read only?!
 

Here's just a quick sample, put it in the code module for the worksheet:

Code:
--------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A10,B2,C5:D10")) Is Nothing Then
MsgBox "You cannot select that cell!, you will now be moved to the next cell to the right!" _
, vbOKOnly, "Invalid Cell Choice"
ActiveCell.Offset(0, 1).Select
End If
End Sub
--------------------


Simon Lloyd;190156 Wrote:
The same applies!, either that or specifically name them in an intersect
range, and make it so that cell cannot be selected, but of course if you
are doing that macro's have to be enabled!



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=52319


dm

Use Data Validation
 
Select Cell
Data - Validation - Setttings - Validation Criteria - Select "Custom" -
in Formula enter "=" (equal sign)
That's it. Excel will not allow you to change value


NA_AB[_2_]

Use Data Validation
 
hey sorry ppl but i would appreciate if i can be provided with a simple code
which may be appear like, ((Range)myapp.cells[r,c]).isreadonly() or something
like that, cuz there are many different cells that i would want to make read
only and many others editable(read n write). And simon, truly speaking, i do
not want to transfer user control to any other cell. Am basically building an
excel com add-in using visual studio and c#.net tech. I can access a range of
cell/ cells in my current application's active sheet and in this sheet i
should be able to make some cells read only dynamically and later should also
be able to remove the constraint(read only) on the cells of my choice.

i see that many things can be done in vb but i am not able to convert or
find similar functionalities in c#, so please provide me with the code in
c#...

Regards,
na_ab


All times are GMT +1. The time now is 11:20 PM.

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