Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Passing a range into a VBA function

All:

I am attempting to pass a cell such as $C10 into a function. Inside
the function, I have the following code:

Dim Rng1 as Range
Set Rng1 = Range("$C10")

This code segment works. Now, if I attempt to pass a named cell into
the code, it compiles but gives the following error message when
"Watched". <Expression not defined in context Type = Empty

Dim Rng1 as Range
Set Rng1 = Range(NamedCell)

Any suggestions?

Thanks in advance.

Cheers.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Passing a range into a VBA function


Set Rng1 = Range(NamedCell)

must be:

Set Rng1 = Range("NamedCell")

HTH

"Floyd" wrote in message
oups.com...
All:

I am attempting to pass a cell such as $C10 into a function. Inside
the function, I have the following code:

Dim Rng1 as Range
Set Rng1 = Range("$C10")

This code segment works. Now, if I attempt to pass a named cell into
the code, it compiles but gives the following error message when
"Watched". <Expression not defined in context Type = Empty

Dim Rng1 as Range
Set Rng1 = Range(NamedCell)

Any suggestions?

Thanks in advance.

Cheers.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Passing a range into a VBA function

Mr. May,

I apologize. The range itself is not names. It is being passed as
reference with the name, NamedCell. For example, Function
Testing(NamedCell as range)

Thanks so much for your assistance.

Cheers.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Passing a range into a VBA function

Set Rng1 =NamedCell

tim


"Floyd" wrote in message
ps.com...
Mr. May,

I apologize. The range itself is not names. It is being passed as
reference with the name, NamedCell. For example, Function
Testing(NamedCell as range)

Thanks so much for your assistance.

Cheers.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Passing a range into a VBA function

Mr. Williams,

That worked perfectly.

Thank you.

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
Passing a range name as an argument to the Index Function Michael Sharpe Excel Discussion (Misc queries) 3 September 5th 12 01:33 PM
Passing a range to a user defined function Gary Nelson Excel Discussion (Misc queries) 1 July 19th 07 04:22 PM
Passing range as an argument in a function Hari[_3_] Excel Programming 1 June 15th 04 02:41 AM
Passing a Range to a Function Problem Rocky McKinley Excel Programming 4 January 7th 04 02:00 AM
Passing an unkown range to a function Newbie3333 Excel Programming 3 December 5th 03 02:14 AM


All times are GMT +1. The time now is 10:16 PM.

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"