View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default concatenate and then execute?

There's nothing built into excel that lets you do that.

But you could create a user defined function that did it.

Option Explicit
Function Eval(myStr As String) As Variant
Eval = Application.Evaluate(myStr)
End Function

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

In your example, you could use:
=eval(a1&b1&c1&d1)
or
=eval(CONCATENATE(A1,B1,C1,D1))

miwarren wrote:

Can you use the concatenate function to create the equation and then
execute that fomula?

Example:

A1 = =
B1 = 1
C1 = +
D1 = 2

=CONCATENATE(A1,B1,C1,D1)

That in turn will give you =1+2 but it doesn't execute it to give you
3. Of course my formula is a bit more complex than this, but if I can
get this one to work then I can apply it to my problem.

Thanks ahead of time...

Mike (Nashville)

--
miwarren
------------------------------------------------------------------------
miwarren's Profile: http://www.excelforum.com/member.php...o&userid=24682
View this thread: http://www.excelforum.com/showthread...hreadid=476780


--

Dave Peterson