Thread: code help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default code help

How about:

with activecell
if .hasformula then
.formula = "=value(" & mid(.formula, 2) & ")"
end if
end with

I'd be very careful using the $ signs. Absolute range addresses could be
severely messed up.



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


--

Dave Peterson