Home |
Search |
Today's Posts |
#1
|
|||
|
|||
#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
|
|||
|
|||
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
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cells User Select Locked after upgrade to Excel 2002 | Excel Discussion (Misc queries) | |||
I NEED HELP with the SPELLNUMBER Function | Excel Worksheet Functions | |||
Excel option to store trendline's coefficients in cells for use | Charts and Charting in Excel | |||
IF function to blank without getting #value in sum function | Excel Worksheet Functions | |||
how to move user defined function | Excel Worksheet Functions |