Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
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
How do I pass series data x-value range to a chart from a cell? Ian Charts and Charting in Excel 1 March 3rd 06 04:10 PM
How to (re)set a range.value to pass -0- to a "double" variable Dennis Excel Discussion (Misc queries) 2 April 15th 05 11:13 AM
Pass string as Parameter in OpenText method No Name Excel Programming 0 January 8th 04 06:22 AM
Can we Pass String to FieldInfo Array to OpenText Method. Niraj Kumar Singh Excel Programming 0 January 8th 04 05:35 AM
Pass file name from Spreadsheet Range Bruce Roberson Excel Programming 5 August 16th 03 12:10 AM


All times are GMT +1. The time now is 11:42 AM.

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

About Us

"It's about Microsoft Excel"