LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 31
Default Excel - randomly locking cells?

Hi,

I'm having an issue with some code, that only started being a problem once I
protected the worksheet.

I have the following macro that clears some cells and checkboxes - tied to a
form button called Clear.

Sub Clear()
Application.ScreenUpdating = False
Columns("U:W").Clear ' Clear columns
Columns("U:W").NumberFormat = "$#,##0.00" ' Make Currencey format
Range("U1").Select ' Select a single cell to avoid confusion
For Each Shp In ActiveSheet.Shapes ' Clear Checkboxes
X = Shp.Type
If X = msoFormControl Then
If Shp.FormControlType = xlCheckBox Then
Shp.ControlFormat.Value = False
End If
End If
Next Shp
Application.ScreenUpdating = True
End Sub

Here's what I'm doing:

I select columns U, V, and W.

I right click, format cells, and uncheck Lock Cells on the protection tab.

I protect my worksheet.

The I can enter random values in these columns.

Then, I want to clear them - and I click clear. It clears them, and no errors.

But the next time I press clear, I get this error message:

Runtime Error '1004'
The cell or chart that you are trying to change is protected and therefore
read-only.

Any ideas why?

(And if I then unprotect the sheet, they show up as locked when I check
their properties - and yet I could change their contents when it was
protected.)

Thanks in advance,

Ben
 
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
Excel cells randomly don't get updated Lost in Excel Excel Discussion (Misc queries) 3 October 7th 08 04:18 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Locking cells in Microsoft Excel Curtis Excel Worksheet Functions 2 September 19th 05 05:55 PM
excel is adding cell numbers randomly into other cells amy Excel Worksheet Functions 0 May 13th 05 12:11 AM
How do I shuffle a group of cells randomly in Excel? golfmoab Excel Discussion (Misc queries) 1 January 22nd 05 01:08 PM


All times are GMT +1. The time now is 08:33 PM.

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"