LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default how to clear all unlocked cells except D4

Hi Excel Programmers,

Excel 2000, xp pro

I'm using the code below to clear unlocked cells.

I call this procedure with three command buttons,

1. cmdReset-used to exit quote without printing
2. cmdAddPart-used to add another part number for the same customer
3. cmdComplete-used to print and store quote

when the associate wants to add a part, I need to keep the customer id
in cell D4 and clear all other unlocked cells.

when the associate resets or completes, I need to clear cell D4 along
with all other unlocked cells.

Does anyone have any suggestions?

Thanks,

Dan
--------------------------------------------------------------------------------------
Sub Clear_Unlocked2()
'clears the unlocked cells in range A1:N100 including merged cells
Dim myCell As Range
Application.EnableEvents = False
For Each myCell In Range("A1:N100")
If myCell.Locked = False Then
If myCell.MergeCells Then
If myCell.Address = myCell.MergeArea(1).Address Then
myCell.MergeArea.ClearContents
End If
Else
myCell.ClearContents
End If
End If
Next myCell
Range("A6").Select
Selection.End(xlUp).Select
Range("A2:C2").Select
Application.EnableEvents = True
End Sub

 
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
clear unlocked cells macro help please CandiC Excel Worksheet Functions 3 November 13th 09 11:37 PM
Macro: Clear contents of unlocked cells Tuckland Excel Programming 5 June 14th 07 12:13 PM
How can I have formatting options like merge cells ,Bold,active for the unlocked cells of the protected worksheet.Is it possible in excel? divya Excel Programming 2 July 20th 06 02:04 PM
Moving from unlocked cells to unlocked cells in an excel form Stacey Lee Excel Worksheet Functions 1 April 24th 06 08:44 PM
Selecting only unlocked cells to clear RAP Excel Programming 5 August 18th 05 02:55 AM


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