Function Val("1") not working

mtheriault2000

Well-known Member
Joined
Oct 23, 2008
Messages
826
Simple code to transfer a string number to a number as long is not working.

Code:
Dim v as long
v= val("12")
 
Xenou,

Tks very much for your wonderful explanation.

I had never thought about Excel accessing his own functions, like Left, Right etc, in different libraries.

Reading your post i'm wondering if you were "not really the kind to have technical answers at my fingertips" who else could be...

Tks again

M.
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Reading your post i'm wondering if you were "not really the kind to have technical answers at my fingertips" who else could be...

someone else who's been involved in this thread ... with a name starting with m ... :biggrin:

ξ
 
Upvote 0
You shouldn't need to add VBA in front of these sort of functions.

There's also another reason, perhaps more common, that causes this behaviour - missing references.

You can check for that under Tools > References...
 
Upvote 0
Without a "can't find project or library" error, I'd guess someone has created an additional Val function somewhere, in which case adding 'VBA.' is a perfectly good resolution, IMO.
 
Upvote 0
Looks like I misread, I thought other functions weren't being recognised too

Still, seems a bit strange to rewrite something like Val.

Might have it's uses though, perhaps it does something with the expected array/table/whatever.
 
Upvote 0
Hello

Thanks to all
V= VBA.Val("12") did do the job

- I did check the priority for VBA and it was in the first place

I'm working on a complex system and new libraries as been added. It is very plausible that one of them as a VAL function that interfered with VBA.VAL.

I did learn something here....

Martin ;)
 
Upvote 0
Martin

You might be able to find out where this other Val comes from if you check the Object Browser.

Obviously only I've you've got the time.:)
 
Upvote 0
Open the VBEditor and press f2.
 
Upvote 0

Forum statistics

Threads
1,224,607
Messages
6,179,871
Members
452,949
Latest member
Dupuhini

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