Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
idgity
 
Posts: n/a
Default #Name? Error in User Defined VB Function

Hi,

I'm new to making VB functions for Excel, but I managed to make one
yesterday that was producing the results I wanted. Now today, after copying
the excel file to a different computer, the function gives me the #Name?
error, even though I haven't changed it or it's arguments. Alt+F11 shows the
function, but the spreadsheet doesn't seem to recognize it. What do I do?
Here is the (very simple) function:

Function BucketWeight(bucket, weights)
BucketWeight = weights(bucket)
End Function

bucket is a number and weights should be an array. I'm calling it like:
=BucketWeight($D3, $B$485:$B$489)

Thanks a lot!
  #2   Report Post  
George Nicholson
 
Posts: n/a
Default

BucketWeight = weights(bucket)

Just a guess but since I don't recognize the weights() function, I'm
guessing Excel might not either? That would explain a #Name error.

Any chance there is a User defined function (or more than one) in a
Personal.xls file that existed on yesterday's machine but not on today's?

HTH,
--
George Nicholson

Remove 'Junk' from return address.


"idgity" wrote in message
...
Hi,

I'm new to making VB functions for Excel, but I managed to make one
yesterday that was producing the results I wanted. Now today, after
copying
the excel file to a different computer, the function gives me the #Name?
error, even though I haven't changed it or it's arguments. Alt+F11 shows
the
function, but the spreadsheet doesn't seem to recognize it. What do I
do?
Here is the (very simple) function:

Function BucketWeight(bucket, weights)
BucketWeight = weights(bucket)
End Function

bucket is a number and weights should be an array. I'm calling it like:
=BucketWeight($D3, $B$485:$B$489)

Thanks a lot!



  #3   Report Post  
idgity
 
Posts: n/a
Default

Ah, that might be it, I was defining a whole bunch of functions yesterday and
one of them might have been called "weights". Funny that it was giving the
right answers though. But I mean for weights to be an array of values passed
in to the function, not another function. I'm passing in a chunk of an
excel column. How do you tell VB it's an array? I've tried:
Function BucketWeight(bucket, weights())
and
Function BucketWeight(bucket, weights() As Integer)
but I still get #Name?

Sorry these are very basic (ha) questions, but I'm used to C++ and java.

Thanks.

"George Nicholson" wrote:

BucketWeight = weights(bucket)


Just a guess but since I don't recognize the weights() function, I'm
guessing Excel might not either? That would explain a #Name error.

Any chance there is a User defined function (or more than one) in a
Personal.xls file that existed on yesterday's machine but not on today's?

HTH,
--
George Nicholson

Remove 'Junk' from return address.


"idgity" wrote in message
...
Hi,

I'm new to making VB functions for Excel, but I managed to make one
yesterday that was producing the results I wanted. Now today, after
copying
the excel file to a different computer, the function gives me the #Name?
error, even though I haven't changed it or it's arguments. Alt+F11 shows
the
function, but the spreadsheet doesn't seem to recognize it. What do I
do?
Here is the (very simple) function:

Function BucketWeight(bucket, weights)
BucketWeight = weights(bucket)
End Function

bucket is a number and weights should be an array. I'm calling it like:
=BucketWeight($D3, $B$485:$B$489)

Thanks a lot!




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
Cells User Select Locked after upgrade to Excel 2002 TWilson Excel Discussion (Misc queries) 1 August 5th 05 12:22 PM
I NEED HELP with the SPELLNUMBER Function vag Excel Worksheet Functions 0 June 21st 05 08:17 AM
Excel option to store trendline's coefficients in cells for use Miguel Saldana Charts and Charting in Excel 9 June 20th 05 08:45 PM
IF function to blank without getting #value in sum function Brad Stevenson Excel Worksheet Functions 5 May 26th 05 10:26 AM
how to move user defined function Grant Excel Worksheet Functions 1 November 17th 04 06:38 PM


All times are GMT +1. The time now is 02:17 PM.

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"