Thread: Macro problem
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Macro problem

Hi Tomski,

Try:

'=============
Function ReturnCell(rang As Range, SearchString As String) As Range
Dim MyCell As Range
For Each MyCell In rang
If MyCell.Value = SearchString Then
Set ReturnCell = MyCell
End If
Next MyCell
End Function
'<<=============

I changed ReturnAddress to ReturnCell because the former suggests, to me at
least, a string function. Similarly, I changed Source to SearchString
because the former suggests a range.

---
Regards,
Norman



"Tomski" wrote in
message ...

Thats works, but the type is important, as I need to use the returned
variable in another function that has a Range for an argument.

If a string is returned then this function doesn't work.

Is it possible to type cast a string to a range?

Cheers,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile:
http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=501149