#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default lock cells

Hi,
I have an information in cells D1:J10.
This information will be updated and added . It means that number of
row can be change any time.
When program is running I use command:
Worksheets("sheet1").Columns.Clear
To save this info I tried to lock that column before Clear:
Worksheets("sheet1").Range("D1:J10").Locked = True , but it is
doesn't help.
How can I save info in that columns.
Thanks'

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default lock cells

The Locked property only applies when the worksheet is protected. If the
worksheet was protected then your Columns.Clear command would result in an
error.

You need to think about why you are running the line of code:
Worksheets("sheet1").Columns.Clear
which clears all data on the sheet. You obvioulsy don't want to do that so
you should determine what range of cells you do want to clear and direct the
macro to just that range. E.g if you only want to clear columns A to C then:
Worksheets("sheet1").Columns("A:C").Clear

Hope this helps
Rowan

" wrote:

Hi,
I have an information in cells D1:J10.
This information will be updated and added . It means that number of
row can be change any time.
When program is running I use command:
Worksheets("sheet1").Columns.Clear
To save this info I tried to lock that column before Clear:
Worksheets("sheet1").Range("D1:J10").Locked = True , but it is
doesn't help.
How can I save info in that columns.
Thanks'


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
Can't lock cells BruceM via OfficeKB.com Excel Discussion (Misc queries) 4 May 6th 10 11:12 PM
Lock Cells Neil Pearce Excel Discussion (Misc queries) 3 May 1st 08 04:05 AM
lock cells [email protected] New Users to Excel 3 February 22nd 08 02:07 PM
Lock Cells Snook Excel Discussion (Misc queries) 1 January 16th 08 06:41 PM
lock used cells MIke Excel Discussion (Misc queries) 6 October 20th 07 12:20 AM


All times are GMT +1. The time now is 06:31 PM.

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

About Us

"It's about Microsoft Excel"