Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Nope no idea. Tried putting that function (which returns "Test") and it didn't run. Just got the #Name?
I take it the function when run in the VBA window works fine. But the function doesn't run from the spreadsheet. And it doesn't error. No idea . quirk of MS Excel...
Which version are you running (being curious) ?
EDIT:
Version Excel 2000 here...
Shoved the code into a module (not the ThisSheet module) and it works fine.
Is it something in your code? (not likely) or perhaps a re-install of excel is required.
Tested with this code:
Code:
Public Function CollateAndCalcShare() As String
CollateAndCalcShare = "Test" & Cells(2, 3)
End Function
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
I know the function definitely does work. It's just that excel won't call it. I've tried everything from adding 0 to the result to try to jog it into action and even linking another cell after the calling cell to fetch the data from it but nothing happens.
Does the function I posted earlier work?
I have the same version excel here at work so I could run a test to see whether its a crap install?
Post the code or a zip file? (if it doesn't breech data protection stuff)
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Replace that line... The bit in bold was the part I added. Seems to run then. Debug fine without it but doesn't like it except on the entering first time unless that is in there, then works fine (cstr? cdbl? your output of the function is double...)
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Word/excel vba is crap against access vba (seems more polished)
Access vba is different and probably worse than vb
vb is worse compared to vb.net
I checked the help files and there is no mention of using custom macros in cells as functions. Which means you may need to put it in the worksheet change to get it to run.
Sorry. Excel is pants. How come you didn't use a vb.net project for this? its pretty simple isn't it??
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Sorry. Excel is pants. How come you didn't use a vb.net project for this? its pretty simple isn't it??
Funny you should say that. I actually did the initial prototype in VB.net just so I could get the stupid algorithm right (which was invented by a typically stupid accountant).
However, the people that are intended to use this system do not have the framework on their machines. So it falls to excel.
Last edited by wossname; Mar 1st, 2005 at 07:46 AM.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...