Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pass a range to a method?
Frank,
If I read it correctly, this should be Function Test(retireDate As Range) Test = retireDate.Name.Name End Function -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Frank Kabel" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pass a range to a method?
Hi Bob
yes, correct :-) -- Regards Frank Kabel Frankfurt, Germany Bob Phillips wrote: Frank, If I read it correctly, this should be Function Test(retireDate As Range) Test = retireDate.Name.Name End Function "Frank Kabel" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pass a range to a method?
Frank
I'm rather suprised this works. As I understand it the Range("").Name method returns a Name object. What I want to do is interrogate the Name object and take a different path depending upon the name of the range passed into the function Why doesn't this compile Function Test(retireDate As Range) As Intege Dim foo As Nam foo = retireDate.Nam Debug.Print fo End Functio So in my example, foo is a Name object and range.Name should return a Name object..... Confusing.... |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pass a range to a method?
It doesn't, for the reasons you state. See my reply.
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Lucifer" wrote in message ... Frank, I'm rather suprised this works. As I understand it the Range("").Name method returns a Name object. What I want to do is interrogate the Name object and take a different path depending upon the name of the range passed into the function. Why doesn't this compile: Function Test(retireDate As Range) As Integer Dim foo As Name foo = retireDate.Name Debug.Print foo End Function So in my example, foo is a Name object and range.Name should return a Name object..... Confusing.... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I pass series data x-value range to a chart from a cell? | Charts and Charting in Excel | |||
How to (re)set a range.value to pass -0- to a "double" variable | Excel Discussion (Misc queries) | |||
Pass string as Parameter in OpenText method | Excel Programming | |||
Can we Pass String to FieldInfo Array to OpenText Method. | Excel Programming | |||
Pass file name from Spreadsheet Range | Excel Programming |