Thread: free cell
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default free cell

Thank you Bob, for both the answer and the general approach of using On
Error. I will use this in the future instead of my (Homer Simpson) usual
practice of banging my head into a wall until a 1004 error pops up.
--
Gary's Student


"Bob Phillips" wrote:

Dim fEmpty
Dim tmp As Range
fEmpty = IsEmpty(ActiveCell)
If fEmpty Then
On Error Resume Next
Set tmp = ActiveCell.DirectPrecedents
On Error GoTo 0
If Not tmp Is Nothing Then
fEmpty = False
End If
On Error Resume Next
Set tmp = ActiveCell.DirectDependents
On Error GoTo 0
If Not tmp Is Nothing Then
fEmpty = False
End If
End If


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Gary''s Student" wrote in message
...
How can I tell if a cell is free (available)?
Free would mean empty and not referred to by another cell on the

worksheet.

--
Gary''s Student