D
dan dungan
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
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