Prev Previous Post   Next Post Next
  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

This line builds the string to return:

myStr = myStr & " & " & myRealRng.Parent.Name

Maybe you could just change it to:

myStr = myStr & " & " & myRealRng.Parent.Name & "--" & mycell.value


(I didn't test it.)

atxcomputers wrote:

Hi

The below U/D function matches a string of characters from a given cell
to text on other sheets and then tells me which sheets it is on.

I would like to find out what it has found but cant seem find how to
get that result.

I have highlighted the bit that does the compare and feel it has
something to do with this

Dave Peterson Wrote:


Option Explicit
Function mySearch(mySearchCell As Range, ParamArray myRng()) As String

Dim myCell As Range
Dim myRealRng As Range
Dim myElement As Variant
Dim myStr As String

myStr = ""

For Each myElement In myRng
If TypeOf myElement Is Range Then
'do the work
Set myRealRng = Nothing
On Error Resume Next
Set myRealRng = Intersect(myElement, myElement.Parent.UsedRange)
On Error GoTo 0

If myRealRng Is Nothing Then
'do nothing
Else
For Each myCell In myRealRng.Cells
If IsEmpty(myCell) Then
'do nothing
Else
If InStr(1, mySearchCell, myCell.Value, _
vbTextCompare) 0 Then
myStr = myStr & " & " & myRealRng.Parent.Name
Exit For
End If
End If
Next myCell
End If
End If
Next myElement

If myStr = "" Then
myStr = "Not Found!"
Else
myStr = Mid(myStr, 4)
End If

mySearch = myStr

End Function

I tried changing myRealRng.Parent.Name but just came back with VALUE#

Hopefully Dave Peterson will help me as he did the above function but
if anyone else can help then please do so


Thanks in advance

Regards

Craig


--
atxcomputers
------------------------------------------------------------------------
atxcomputers's Profile: http://www.excelforum.com/member.php...o&userid=26852
View this thread: http://www.excelforum.com/showthread...hreadid=400972


--

Dave Peterson


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help from Dave Peterson - no disrespect to all other experts Ann Excel Discussion (Misc queries) 1 March 10th 05 05:34 PM
Help from Dave Peterson - no disrespect to all other experts Ann Excel Discussion (Misc queries) 0 March 10th 05 12:45 PM
UDF and Calculation tree Ken Wright Links and Linking in Excel 1 February 6th 05 04:58 PM
Attn: Dave P. Question re Pix Calls via Macro DocuMike Excel Discussion (Misc queries) 1 January 10th 05 01:38 AM
Help... File Not Saved SteveHoot Excel Discussion (Misc queries) 0 January 5th 05 10:45 AM


All times are GMT +1. The time now is 07:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"