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

It's actually two lines:

Public Function CONCandEVAL(ParamArray rng())
Dim stemp As String
Dim i As Long
For i = LBound(rng()) To UBound(rng())
stemp = stemp & rng(i)
Next i
CONCandEVAL = Evaluate(stemp)
End Function

miwarren wrote:

I got an error msg on the Dim i As Long For i = LBound(rng()) To
UBound(rng()) part.

Bob Phillips Wrote:
Try a UDF

Public Function CONCandEVAL(ParamArray rng())
Dim stemp As String
Dim i As Long For i = LBound(rng()) To UBound(rng())
stemp = stemp & rng(i)
Next i
CONCandEVAL = Evaluate(stemp)
End Function

Use like =CONCandEVAL(A1,B1,C1,D1)


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"miwarren"
wrote in
message ...

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


--
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