Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Using functions in string formatted cells

I created my own function in Module1 which looks as follows:

Public Function Foo (ByVal strData as String)

Foo = "Hello World!" ' Return basic string

End Function


On my actual spreadsheet, cell "A1" is formatted as a "text"
type cell, there I cannot simply plug in my Foo() function
into cell "A1". I tried putting the following value into
cell "A1":

=Foo(A1)

If i enter that formula into cell A1 (which is a text cell), then
Excel will simply enter the above formula as a string, instread
of running the function.

So I guess my question is, how can I enter formulas into
cells that are formatted as "text"??

thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Using functions in string formatted cells

It is nothing to do with being formatted as text. You cannot have a function
and a value in a cell, one or the other.

So you can have a value in A1 and put this in A2, =Foo(A1), but not what you
are trying to do.


"Robert Crandal" wrote in message
...
I created my own function in Module1 which looks as follows:

Public Function Foo (ByVal strData as String)

Foo = "Hello World!" ' Return basic string

End Function


On my actual spreadsheet, cell "A1" is formatted as a "text"
type cell, there I cannot simply plug in my Foo() function
into cell "A1". I tried putting the following value into
cell "A1":
=Foo(A1)

If i enter that formula into cell A1 (which is a text cell), then
Excel will simply enter the above formula as a string, instread
of running the function.

So I guess my question is, how can I enter formulas into
cells that are formatted as "text"??

thank you



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Using functions in string formatted cells

Just set the format to General. If a string is returned from the function, such as 0123, it will display 0123 instead of 123.


On 13-Dec-2009 12:47, Robert Crandal wrote:
If i enter that formula into cell A1 (which is a text cell), then
Excel will simply enter the above formula as a string, instread
of running the function.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Using functions in string formatted cells

You cannot.

Why are the cells cell formatted as text?

Can you not change to General or some other format?


Gord Dibben MS Excel MVP


On Sat, 12 Dec 2009 16:47:10 -0700, "Robert Crandal"
wrote:

I created my own function in Module1 which looks as follows:

Public Function Foo (ByVal strData as String)

Foo = "Hello World!" ' Return basic string

End Function


On my actual spreadsheet, cell "A1" is formatted as a "text"
type cell, there I cannot simply plug in my Foo() function
into cell "A1". I tried putting the following value into
cell "A1":

=Foo(A1)

If i enter that formula into cell A1 (which is a text cell), then
Excel will simply enter the above formula as a string, instread
of running the function.

So I guess my question is, how can I enter formulas into
cells that are formatted as "text"??

thank you


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Using functions in string formatted cells

Missed the circ ref problem but that would become apparent only if the cell
were not formatted as text.


Gord

On Sat, 12 Dec 2009 23:57:23 -0000, "Bob Phillips"
wrote:

It is nothing to do with being formatted as text. You cannot have a function
and a value in a cell, one or the other.

So you can have a value in A1 and put this in A2, =Foo(A1), but not what you
are trying to do.


"Robert Crandal" wrote in message
...
I created my own function in Module1 which looks as follows:

Public Function Foo (ByVal strData as String)

Foo = "Hello World!" ' Return basic string

End Function


On my actual spreadsheet, cell "A1" is formatted as a "text"
type cell, there I cannot simply plug in my Foo() function
into cell "A1". I tried putting the following value into
cell "A1":
=Foo(A1)

If i enter that formula into cell A1 (which is a text cell), then
Excel will simply enter the above formula as a string, instread
of running the function.

So I guess my question is, how can I enter formulas into
cells that are formatted as "text"??

thank you



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find a specific formatted string in a cell KCK Excel Worksheet Functions 1 April 16th 08 09:16 PM
Formatted Number into String Variable, Excel VBA [email protected] Excel Programming 3 March 16th 06 11:20 PM
Converting 'General' formatted cells to Text formatted cell using. Zahid Khan Excel Worksheet Functions 1 March 12th 05 07:13 PM
How to make a cell return the formatted value in a text string (i. n.almeida Excel Worksheet Functions 3 February 2nd 05 01:59 PM
help with string functions margie[_6_] Excel Programming 2 February 25th 04 02:34 PM


All times are GMT +1. The time now is 10:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"