Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bunnis
 
Posts: n/a
Default Saving some cells

I have a protected worksheet with some cells unprotected, and this works
fine till I run a macro to essentally clear some of the unprotected cells.
The cells get cleared but the 'unprotected' cells get locked in the process.
Is there a way round this or am I missing the obvious.
Have included the macro code for your comments

Many thanks
Bernard


Sub Macro1()
'
' '
' Keyboard Shortcut: Ctrl+d
'
Application.Goto Reference:="R6C1"
Range("A6").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A6:AF28").Select
Selection.Clear
Application.Goto Reference:="R32C1"
Range("A32:AF38").Select
Selection.Clear
Application.Goto Reference:="R42C1"
Range("A42:AF48").Select
Selection.Clear
Application.Goto Reference:="R1C2"
Range("B1").Select
ActiveCell.FormulaR1C1 = "N"
Selection.AutoFill Destination:=Range("B1:AF1"), Type:=xlFillDefault
Range("B1:AF1").Select
'Range("U21").Select
Application.CommandBars("Stop Recording").Visible = False
Range("A3").Select
MsgBox "Enter First Date of the Month, eg 1/10/2006"
MsgBox "Confirm Public Holidays, Change N to Y, where appropriate "
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Norman Jones
 
Posts: n/a
Default Saving some cells

Hi Bunnis,

I have a protected worksheet with some cells unprotected, and this works
fine till I run a macro to essentally clear some of the unprotected cells.
The cells get cleared but the 'unprotected' cells get locked in the
process.


Replace each instance of :

Selection.Clear


with

Selection.ClearContents

If, however, you also need to delete formats, change each instance of:

Selection.Clear


to

With Selection
.Clear
.Locked = False
End with


---
Regards,
Norman



"Bunnis" wrote in message
...
I have a protected worksheet with some cells unprotected, and this works
fine till I run a macro to essentally clear some of the unprotected cells.
The cells get cleared but the 'unprotected' cells get locked in the
process.
Is there a way round this or am I missing the obvious.
Have included the macro code for your comments

Many thanks
Bernard


Sub Macro1()
'
' '
' Keyboard Shortcut: Ctrl+d
'
Application.Goto Reference:="R6C1"
Range("A6").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A6:AF28").Select
Selection.Clear
Application.Goto Reference:="R32C1"
Range("A32:AF38").Select
Selection.Clear
Application.Goto Reference:="R42C1"
Range("A42:AF48").Select
Selection.Clear
Application.Goto Reference:="R1C2"
Range("B1").Select
ActiveCell.FormulaR1C1 = "N"
Selection.AutoFill Destination:=Range("B1:AF1"), Type:=xlFillDefault
Range("B1:AF1").Select
'Range("U21").Select
Application.CommandBars("Stop Recording").Visible = False
Range("A3").Select
MsgBox "Enter First Date of the Month, eg 1/10/2006"
MsgBox "Confirm Public Holidays, Change N to Y, where appropriate "
End Sub





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
Linking Groups of cells between workbooks vnacj-joe Excel Discussion (Misc queries) 4 June 14th 07 05:18 PM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
Counting empty cells within a range of cells Rosehill - ExcelForums.com New Users to Excel 0 April 7th 05 12:47 AM
Help adding text values Texas-DC_271 Excel Worksheet Functions 7 January 15th 05 11:14 PM
Convert data type of cells to Text,Number,Date and Time Kevin Excel Worksheet Functions 1 December 31st 04 12:57 PM


All times are GMT +1. The time now is 05:42 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"