Hi,
The logic appears to be a bit weird:

If Not IsEmpty(rCell) Or HasDependents(rCell) = True Then
Range(rCell.Address).Select
Exit Sub
End If

If the first cell in the selected range is not empty, or has dependents, then 
that cell is selected, and the sub exits.
What do you actually want the macro to do with what it finds?
 
Regards - Dave.
 

> Sub Whats_In_Range()
> Dim rCell As Range
> For Each rCell In Selection.Cells
> If Not IsEmpty(rCell) Or HasDependents(rCell) = True Then
> Range(rCell.Address).Select
> Exit Sub
> End If
> 
> Next rCell
> MsgBox "Nothing found."
> End Sub
> 
> Function HasDependents(ByRef CellPassedIn As Range) As Boolean
> Dim objRng As Range
> On Error Resume Next
> Set objRng = CellPassedIn.Dependents
> On Error GoTo 0
> HasDependents = Not objRng Is Nothing
> End Function
> 
> -- 
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links : 
> http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
> 
> To post to this group, send email to excel-macros@googlegroups.com
> 
> <><><><><><><><><><><><><><><><><><><><><><>
> Like our page on facebook , Just follow below link
> http://www.facebook.com/discussexcel
                                          

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to