function for looking up text

March 14th, 2008 - 10:11 am ET by Kathl | Report spam
hi, don't know what's wrong with this function. it shall take the value of a
cell and via select case look, whats in it and write into the active cell a
certain text.

Function PreTimeSlotsConv18(PreSlot18)
Select Case PreSlot18
Case "Slot 1"
PreTimeSlotsConv18 = "17:35"
Case "Slot 2"
PreTimeSlotsConv18 = "17:20"
Case "Slot3"
PreTimeSlotsConv18 = "17:05"
End Select
End Function

cheers
email Follow the discussionReplies 5 repliesReplies Make a reply

Similar topics

Replies

#1 Bob Phillips
March 14th, 2008 - 10:20 am ET | Report spam
Works fine here. I presume you are using it in a worksheet? What do you get?


HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Kathl" wrote in message
news:
hi, don't know what's wrong with this function. it shall take the value of
a
cell and via select case look, whats in it and write into the active cell
a
certain text.

Function PreTimeSlotsConv18(PreSlot18)
Select Case PreSlot18
Case "Slot 1"
PreTimeSlotsConv18 = "17:35"
Case "Slot 2"
PreTimeSlotsConv18 = "17:20"
Case "Slot3"
PreTimeSlotsConv18 = "17:05"
End Select
End Function

cheers


Replies Reply to this message
#2 Mike H
March 14th, 2008 - 10:21 am ET | Report spam
Hi,

Apart from a small (I assume) typo Slot3 Slot 3 I can see nothing wrong with
it. If you call it with:-

=PreTimeSlotsConv18(A1)

If A1 contains Slot 1 it returns the text string 17:35. Is that what you
want it to do?

Mike


"Kathl" wrote:

hi, don't know what's wrong with this function. it shall take the value of a
cell and via select case look, whats in it and write into the active cell a
certain text.

Function PreTimeSlotsConv18(PreSlot18)
Select Case PreSlot18
Case "Slot 1"
PreTimeSlotsConv18 = "17:35"
Case "Slot 2"
PreTimeSlotsConv18 = "17:20"
Case "Slot3"
PreTimeSlotsConv18 = "17:05"
End Select
End Function

cheers


Replies Reply to this message
#3 Kathl
March 14th, 2008 - 10:50 am ET | Report spam
now i'm really getting lunatic...

before i wrote to you the output was #name;

now if i invoke the function in excel it just say's that there is no
argument in parentheses...that's not possible...

"Bob Phillips" wrote:

Works fine here. I presume you are using it in a worksheet? What do you get?


HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Kathl" wrote in message
news:
> hi, don't know what's wrong with this function. it shall take the value of
> a
> cell and via select case look, whats in it and write into the active cell
> a
> certain text.
>
> Function PreTimeSlotsConv18(PreSlot18)
> Select Case PreSlot18
> Case "Slot 1"
> PreTimeSlotsConv18 = "17:35"
> Case "Slot 2"
> PreTimeSlotsConv18 = "17:20"
> Case "Slot3"
> PreTimeSlotsConv18 = "17:05"
> End Select
> End Function
>
> cheers





Replies Reply to this message
#4 Mike H
March 14th, 2008 - 11:10 am ET | Report spam
Hi,

If you have no argument - cell reference - in the formula then you'll get
#value! error

Mike

"Kathl" wrote:

now i'm really getting lunatic...

before i wrote to you the output was #name;

now if i invoke the function in excel it just say's that there is no
argument in parentheses...that's not possible...

"Bob Phillips" wrote:

> Works fine here. I presume you are using it in a worksheet? What do you get?
>
>
> HTH
>
> Bob
>
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
>
>
> "Kathl" wrote in message
> news:
> > hi, don't know what's wrong with this function. it shall take the value of
> > a
> > cell and via select case look, whats in it and write into the active cell
> > a
> > certain text.
> >
> > Function PreTimeSlotsConv18(PreSlot18)
> > Select Case PreSlot18
> > Case "Slot 1"
> > PreTimeSlotsConv18 = "17:35"
> > Case "Slot 2"
> > PreTimeSlotsConv18 = "17:20"
> > Case "Slot3"
> > PreTimeSlotsConv18 = "17:05"
> > End Select
> > End Function
> >
> > cheers
>
>
>


Replies Reply to this message
#5 Rick Rothstein \(MVP - VB\)
March 14th, 2008 - 11:24 am ET | Report spam
A #NAME? error? It sounds like you do not have the function located in a
Module... functions for use in worksheet formulas must be located on a
regular Module (not Class Module).

Rick


"Kathl" wrote in message
news:
now i'm really getting lunatic...

before i wrote to you the output was #name;

now if i invoke the function in excel it just say's that there is no
argument in parentheses...that's not possible...

"Bob Phillips" wrote:

Works fine here. I presume you are using it in a worksheet? What do you
get?


HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Kathl" wrote in message
news:
> hi, don't know what's wrong with this function. it shall take the value
> of
> a
> cell and via select case look, whats in it and write into the active
> cell
> a
> certain text.
>
> Function PreTimeSlotsConv18(PreSlot18)
> Select Case PreSlot18
> Case "Slot 1"
> PreTimeSlotsConv18 = "17:35"
> Case "Slot 2"
> PreTimeSlotsConv18 = "17:20"
> Case "Slot3"
> PreTimeSlotsConv18 = "17:05"
> End Select
> End Function
>
> cheers







email Follow the discussion Replies Reply to this message
Help Create a new topicReplies Make a reply
Search Make your own search