View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Pass a range to a method?

Hi
maybe the following is what you're trying to do?
Sub testit()
Debug.Print "Result: ", Test(Range("test"))
End Sub

Function Test(retireDate As Range)
Dim foo
foo = retireDate.Name
Test = foo
End Function

--
Regards
Frank Kabel
Frankfurt, Germany


Lucifer wrote:
I am trying to write a function that will take a different action
based upon the name of a range passes to it. As I understand it the
Range.Name returns a Name object. However, I can't get by the
invalid use of Property

Sub testit()
Debug.Print "Result: ", Test(Range("Retire_Date_Primary"))
End Sub

Function Test(retireDate As Range) As Integer
Dim foo As Name
foo = retireDate.Name
End Function