disable excell sheet cell from VB Script

  • Thread starter Thread starter itsmaheshp
  • Start date Start date
I

itsmaheshp

Hai guys,
i want to disable the cell(making user not to enter the data in
particular cell) from VB Script(here i have to use VB Script becoz
have to disable this cell based on som other conditions.).
plz help me...
Thanks & regards,
Mahesh
 
Hi
something like
with activesheet
..unprotect
..range("A1").locked=true
..protect
end with
 
Here you are a solution:

If myCondition Then
Range("A1").Select 'e.g.
Selection.Locked = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
' it locks all cells in the worksheet, so set .Locked = False for the
non-disabled cells!
'or with password
ActiveSheet.Protect Password:="myPassword", DrawingObjects:=True,
Contents:=True, Scenarios:=True
End If

Regards Stefi


„itsmaheshp†ezt írta:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top