Thread: code help
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jim May Jim May is offline
external usenet poster
 
Posts: 477
Default code help

Bob,
Thanks - it (your code) works great;
and as far as Dave's code... - I had not seen it until AFTERWARDS.
It too is worthy!!
Appreciation here,,
Jim May



"Bob Phillips" wrote:

This will replace any $ in your formula as well, so I think it should be

ActiveCell.Formula = _
Application.Substitute(ActiveCell.Formula, "=", "~~")
ActiveCell.Formula = _
Application.Substitute(ActiveCell.Formula, "~~", "=VALUE(") & ")"

but what is wrong with Dave's suggestion?
--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Jim May" wrote in message
...
John Thanks,
Still getting R/T 1004 with:

ActiveCell.Formula =
Application.WorksheetFunction.Substitute(ActiveCel l.Formula, "=", "$")
ActiveCell.Formula =
Application.WorksheetFunction.Substitute(ActiveCel l.Formula, "$",

"=VALUE(" &
ActiveCell.Formula & ")")

Thanks for your help, we're almost there, I can taste it...



"John.Greenan" wrote:

you need a closing ")" on the "=value(" statement
so something like

Application.WorksheetFunction.Substitute(ActiveCel l.Formula, "$",

"=VALUE("
& ActiveCell.Formula & ")")

should do it.n Post back if that does not work.

Please rate this post if it's helpful to you.


--
www.alignment-systems.com


"Jim May" wrote:

I need to Wrap an existing formularized Cell with the Function

=VALUE()
using a VBA Statement. The below is not quite working . Can someone

assist
me in getting the proper syntax to get it going???

Tks in Advance..
Jim May


Sub Macro5()
'
' Macro5 Macro
' Macro recorded 6/29/2006 by Jim May
'Step 1:
ActiveCell.Formula =
Application.WorksheetFunction.Substitute(ActiveCel l.Formula, "=", "$")
'Step 2:
ActiveCell.Formula =
Application.WorksheetFunction.Substitute(ActiveCel l.Formula, "$",

"=VALUE(""
&")

End Sub