View Single Post
  #3   Report Post  
aken
 
Posts: n/a
Default

well,

i just got to solve this by this method.

If (ActiveSheet.Cells(1,1)<30) then
ActiveSheet.Unprotect
Range("B1:B10").Locked = False
ActiveSheet.Protect
End If

i.e on one cell condition, whole of the range must be locked and this code
does just that. well, i have this new query...

when i run this code, though the cells/range get locked and data editing
prohibited, the cursor movement is possible.

how can i restrict even the cursor movement over it.

as seen in the protect sheet,

"select locked cells"; is usally unchecked manually which makes cursor
movement not possible. the same thing needs to be incorporated in the VBA.
as a test i tried this:

ActiveSheet.selectlockedcells = False

though there is no such thing, i want you to suggest what is the correct
one.

aken

"JPW" wrote:

What you need is a VBA procedure. Are you looking at EVERY value in column A
of this worksheet, which will then effect all cells in that row to the
right, or are you looking at just one cell (A1) which will effect just one
range (B2:B10)?

"aken" wrote in message
...
hi,

how a cell or a range of cells be locked based on another cells value?
let
me explain

if cell(A1)'s value is less then 30 then cell(b2) or cells b2:b10 must
be locked. user must not be able to do anything then on these cells.
othewise
it must be open for editing.

aken