Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A way to programmitically lock cells?

Is there a way to programmatically lock cells in a worksheet

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default A way to programmitically lock cells?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A way to programmitically lock cells?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default A way to programmitically lock cells?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A way to programmitically lock cells?

Thanks, that fixed the problem up perfectly, thanks Haral

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lock Cells Neil Pearce Excel Discussion (Misc queries) 3 May 1st 08 04:05 AM
Lock Cells Snook Excel Discussion (Misc queries) 1 January 16th 08 06:41 PM
How To Lock Cells Ziggy M Excel Discussion (Misc queries) 3 August 18th 06 02:24 PM
Lock all cells? JoeBed Excel Discussion (Misc queries) 8 June 1st 06 07:21 PM
how can I lock certain cells? Linds Excel Discussion (Misc queries) 2 December 20th 05 10:46 PM


All times are GMT +1. The time now is 07:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"