Cannot run VBA code?!?!

lottrup

New Member
Joined
Mar 9, 2009
Messages
16
Hi

I have a problem running VBA code. My colleague has programmed functions (modules and classes), but it simply does not work for me. I know that the code is ok, but maybe I got some Excel properties wrong...? The cell calling the function simply returns '#VALUE!'. Do I have to allow for the VBA code to run or something like that?

Hope someone can help :)
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Depends on the code (please post if possible) and how the workbook is set up. Is it event driven code or a standalone module?
 
Upvote 0
How do you know the code is OK?

Getting an error like that actually indicates it might not be.

It might not be specifically the code itself but something that the code isn't dealing with.

That could be down to different versions, the problem could even be caused by 'bad' data.:)
 
Upvote 0
I know it's okay because I got a workbook where these functions were used and worked perectly fine. But as soon as I recalculate the formulas it returns #VALUE!. That's why I thought it was just my Excel settings that were wrong...
 
Upvote 0
That really doesn't mean the code is OK.

If you are getting an error surely it means there could be a problem with the code and/or the data.:)
 
Upvote 0
It's a quite long piece of code.. It consists of a class and a module of functions. How could I change the way the workbook is set up to run code?
 
Upvote 0
Hi Lottrup,

Norie is right, without the code this will be very difficult to answer, and the error given does sound like its the code at fault.

A guess however;

One property that can cause problems for VBA when ran on different machines is the 'Hide extensions for known file types' property. What this means is, if the VBA code is refering to a file name of some sort and including/excluding the file name eg '.XLS' this might have an effect when ran on a different machine. To change this setting you can tick/untick the option from Explorer, under Tools, Folder Options, in the View tab.

There are loads of things like this that if not coded correctly could be causing your issues.

Why not step through the functions to try and see where the problems arise.

Cheers
GB
 
Upvote 0
FWIW, if your problem was truly that the macros weren't running (and therefore you couldn't access the UDFs your friend created), you'd get a #NAME? error as opposed to a #VALUE! error.

The fact that you're getting a #VALUE! error suggests that the code/function is running, it's just returning an error.
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top