![]() |
#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! |
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! |
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! |
All times are GMT +1. The time now is 01:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com