View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Custom Function behaviour?

Dim dblVar as Double
dblVar = cdbl(Range("Q3").Value)

--
Regards,
Tom Ogilvy

"Ron" wrote in message
10.201...
"Bernard Liengme" wrote in
:

Hi Ron,
Now that problem is cleared up you might want to read VBA Help to learn
about the Select Case function - so much more elegant than a bunch of
ElseIf's

Bernard



Hi guys, thanks for the help & tuition.

Bernard, I knew there would be several ways to do this, but at my stage of
learning I was more familiar with the if/then statements.

I did try to get it all in a few lines by assigning variables to the
relevant values, but I got stuck on the fact that the fractions that were
being taken from the cell Q3 were formatted as text and I couldn't get

them
to be read as a fraction, and then as a number in the variable.

I could do this by plonking the value of the fraction in a spare cell in
the sheet and then grabbing that for use in the function, but I'm at a

loss
as to changing the format of a variable within the function, if this is at
all possible.

The above paragraph probably makes little sense to others who read this,
but I know what I'm on about ;)

Thanks guys,

Ron