Ron,
I think this is what you want to do?
'------------------------------------------
Sub SelectionClearTest()
' Jim Cone - San Francisco, CA - September 07, 2004
' Clears cells in selection except for formulas and their precedents.
Dim objRngPrec As Excel.Range
Dim objRngForm As Excel.Range
Dim objRngBoth As Excel.Range
Dim objRngAll As Excel.Range
Dim objRng As Excel.Range
Set objRngAll = Selection
On Error Resume Next
Set objRngForm = objRngAll.SpecialCells(xlCellTypeFormulas)
On Error GoTo 0
If objRngForm Is Nothing Then
MsgBox "No Formulas in Selection. "
Set objRngAll = Nothing
Exit Sub
End If
On Error Resume Next
Set objRngPrec = objRngForm.Precedents
On Error GoTo 0
If objRngPrec Is Nothing Then
Set objRngPrec = objRngForm
End If
Set objRngBoth = Application.Union(objRngForm, objRngPrec)
For Each objRng In objRngAll.Cells
If Application.Intersect(objRng, objRngBoth) Is Nothing Then
objRng.ClearContents
End If
Next 'objRng
Set objRngPrec = Nothing
Set objRngForm = Nothing
Set objRngBoth = Nothing
Set objRngAll = Nothing
Set objRng = Nothing
End Sub
'------------------------------------------
Regards,
Jim Cone
San Francisco, CA