Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Getting #VALUE in cells with User Defined Functions

Hi,
I have a User Defined Function in a module for a workbook that is referenced
in some cells.

Occasionally, I get the #VALUE error even when I have Auto Calc On and the
error doesn't even clear when I do F9 Update Calculations.

The only way I can get it to calculate is if I click on a cell Formula Bar
that is referenced in the formula and hit "enter". This seems to trigger a
refresh or calculation.

For example:
UDF "Get_Range_Add" is called in cell C2,
A range named "RangeName" points to cell $A$4 on Sheet1
The result in C2 should say "$A$4" which is the address of the range called
"RangeName" found on "Sheet1".

However, it says "#VALUE" unless I click somehwere in either cell B1 or A2
Formula Bar, then press "Enter". Then all formulas that look at linked the
cell I just clicked on get refreshed. Again, it only calculates if Excel
thinks I actually modified one of those cells.

Thanks for any help,
MikeZz

A B C D
1 "Sheet1"
2 "RangeName" =Get_Range_Add(G6,F7)
3



Here is my User Defined Function:

Function Get_Range_Add(shtName As String, rngName As String)
Dim add As String

add = Sheets(shtName).Range(rngName).Address
Get_Range_Add = add

End Function

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Getting #VALUE in cells with User Defined Functions

Please supply the code of the UDF and the way it is called.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"MikeZz" wrote in message ...
| Hi,
| I have a User Defined Function in a module for a workbook that is referenced
| in some cells.
|
| Occasionally, I get the #VALUE error even when I have Auto Calc On and the
| error doesn't even clear when I do F9 Update Calculations.
|
| The only way I can get it to calculate is if I click on a cell Formula Bar
| that is referenced in the formula and hit "enter". This seems to trigger a
| refresh or calculation.
|
| For example:
| UDF "Get_Range_Add" is called in cell C2,
| A range named "RangeName" points to cell $A$4 on Sheet1
| The result in C2 should say "$A$4" which is the address of the range called
| "RangeName" found on "Sheet1".
|
| However, it says "#VALUE" unless I click somehwere in either cell B1 or A2
| Formula Bar, then press "Enter". Then all formulas that look at linked the
| cell I just clicked on get refreshed. Again, it only calculates if Excel
| thinks I actually modified one of those cells.
|
| Thanks for any help,
| MikeZz
|
| A B C D
| 1 "Sheet1"
| 2 "RangeName" =Get_Range_Add(G6,F7)
| 3
|
|
|
| Here is my User Defined Function:
|
| Function Get_Range_Add(shtName As String, rngName As String)
| Dim add As String
|
| add = Sheets(shtName).Range(rngName).Address
| Get_Range_Add = add
|
| End Function
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Getting #VALUE in cells with User Defined Functions

The UDF is in my original post....

Here is my User Defined Function:
| Function Get_Range_Add(shtName As String, rngName As String)
| Dim add As String
|
| add = Sheets(shtName).Range(rngName).Address
| Get_Range_Add = add
|
| End Function

It's called the following way:
where cell G6 has the name of a sheet and F7 has the name of the range.

=Get_Range_Add(G6,F7)

"Niek Otten" wrote:

Please supply the code of the UDF and the way it is called.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"MikeZz" wrote in message ...
| Hi,
| I have a User Defined Function in a module for a workbook that is referenced
| in some cells.
|
| Occasionally, I get the #VALUE error even when I have Auto Calc On and the
| error doesn't even clear when I do F9 Update Calculations.
|
| The only way I can get it to calculate is if I click on a cell Formula Bar
| that is referenced in the formula and hit "enter". This seems to trigger a
| refresh or calculation.
|
| For example:
| UDF "Get_Range_Add" is called in cell C2,
| A range named "RangeName" points to cell $A$4 on Sheet1
| The result in C2 should say "$A$4" which is the address of the range called
| "RangeName" found on "Sheet1".
|
| However, it says "#VALUE" unless I click somehwere in either cell B1 or A2
| Formula Bar, then press "Enter". Then all formulas that look at linked the
| cell I just clicked on get refreshed. Again, it only calculates if Excel
| thinks I actually modified one of those cells.
|
| Thanks for any help,
| MikeZz
|
| A B C D
| 1 "Sheet1"
| 2 "RangeName" =Get_Range_Add(G6,F7)
| 3
|
|
|
| Here is my User Defined Function:
|
| Function Get_Range_Add(shtName As String, rngName As String)
| Dim add As String
|
| add = Sheets(shtName).Range(rngName).Address
| Get_Range_Add = add
|
| End Function
|



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
Using User-Defined Functions in Cells Trent Argante[_2_] Excel Programming 0 June 13th 07 03:54 PM
Using User-Defined Functions in Cells NickHK[_3_] Excel Programming 2 June 13th 07 03:36 PM
Using User-Defined Functions in Cells Dave Peterson Excel Programming 0 June 13th 07 03:11 PM
User Defined Functions - Help Text - Make it Easy for the User Andibevan[_2_] Excel Programming 4 March 17th 05 09:51 AM
excel functions and User defined functions Kanan Excel Programming 4 May 20th 04 11:21 PM


All times are GMT +1. The time now is 08:12 AM.

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"