Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to programmatically lock cells in a worksheet
-- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Record a macro while doing it and you're almost there.
HTH. Best wishes Harald "RPIJG " skrev i melding ... Is there a way to programmatically lock cells in a worksheet? --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 "RPIJG " skrev i melding ... I did this, but now I have a reference to range error, what's wrong with 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").Select -------------------- I did have ActiveWorkbook.Worksheets("Customer Invoice").Range("B2:P57").Select for that line, and it gave the same problem...do I have to activate the worksheet? --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, that fixed the problem up perfectly, thanks Haral
-- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Lock Cells | Excel Discussion (Misc queries) | |||
Lock Cells | Excel Discussion (Misc queries) | |||
How To Lock Cells | Excel Discussion (Misc queries) | |||
Lock all cells? | Excel Discussion (Misc queries) | |||
how can I lock certain cells? | Excel Discussion (Misc queries) |