I wrote some code to search a range of cells to locate non-blank cells and cells with dependents. (A clever contributor on these forums, Jim Cone, was pivotal- thank you, Jim!)
I had this code running correctly at one point, but lost the file that contained the working code. I've tried to recreate it, but with no success so far. This code compiles but all it does is return the cell pointer to the upper left corner of the selected range. Can anyone tell me what I've done wrong? ~Thanks. 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