From: Isis on
I am using the following to Clear a group of cells;
Range("AP1:AP1500").Clear

however, after using this code I notice that the cells are Locked rather
than Unlocked as they were originally - this then causes problems in other
code I have running as the sheet is protected when distributed.

Is there something elase I can do to solve the problem ?

Thanks
From: Mike H on
Hi,

> Is there something elase I can do to solve the problem ?

Post all you code because that line of code won't change the locked status
of the cells.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Isis" wrote:

> I am using the following to Clear a group of cells;
> Range("AP1:AP1500").Clear
>
> however, after using this code I notice that the cells are Locked rather
> than Unlocked as they were originally - this then causes problems in other
> code I have running as the sheet is protected when distributed.
>
> Is there something elase I can do to solve the problem ?
>
> Thanks
> .
>
From: Isis on
=?Utf-8?B?TWlrZSBI?= <MikeH(a)discussions.microsoft.com> wrote in
news:10630CC1-C223-40D0-985E-C5576237E1CD(a)microsoft.com:

> Hi,
>
>> Is there something elase I can do to solve the problem ?
>
> Post all you code because that line of code won't change the locked
> status of the cells.

Mike,
thanks for replying.

If I UNLOCK cells AP1:AP10 and then 'protect' the sheet then I issue a
Range("AP1:AP10").Clear statement - cells AP1:AP10 are now locked ?

the code is on a button and prior to clicking it I highlight cells AP1:AP10
and Format | Cells | Protection | Clear the Locked tick box - then protect
the sheet then click the button. The cells now show as Locked.

Any ideas ?

Thanks

From: Dave Peterson on
After you clear the cells, the cells go back to having the Normal style.

So you have a couple of choices.

#1. range("AP1:AP1500").clearcontents 'leave formatting alone
or
#1A. range("AP1:AP1500").value = "" 'formatting untouched here, too

or

#2. change the Normal style for this workbook.

In xl2003 menus:
Format|Style...
select Normal
Uncheck the Locked checkbox.

Remember that Styles live in workbooks. You'll have to change the Normal style
in any workbook where you need this ability.

Isis wrote:
>
> I am using the following to Clear a group of cells;
> Range("AP1:AP1500").Clear
>
> however, after using this code I notice that the cells are Locked rather
> than Unlocked as they were originally - this then causes problems in other
> code I have running as the sheet is protected when distributed.
>
> Is there something elase I can do to solve the problem ?
>
> Thanks

--

Dave Peterson