A way to programmitically lock cells?

  • Thread starter Thread starter RPIJG
  • Start date Start date
Record a macro while doing it and you're almost there.

HTH. Best wishes Harald
 
I did this, but now I have a reference to range error, what's wrong wit
this?


Code
-------------------
ActiveWorkbook.Worksheets("Sales Invoice").Range("B2:P57").Select
Selection.Locked = True
Selection.FormulaHidden = False
Worksheets("Customer Invoice").Range("B2:P56").Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveWorkbook.Worksheets("Sales Invoice").Range("C19").Selec
-------------------


I did have ActiveWorkbook.Worksheets("Custome
Invoice").Range("B2:P57").Select for that line, and it gave the sam
problem...do I have to activate the worksheet
 
I said "almost". The errors would probably have to do with either selecting
(unnecessary, you almost never have to select or activate anything) or with
non-existing sheet names (you fix that). For the former, edit down to

Worksheets("Sales Invoice").Range("B2:P57").Locked = True
Worksheets("Customer Invoice").Range("B2:P56").Locked = True

HTH. Best wishes Harald
 

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