#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default code help

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default code help

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default code help

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default code help

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





  #6   Report Post  
Posted to microsoft.public.excel.programming
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




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default code help

It is better IMO <vbg

--
HTH

Bob Phillips

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

"Jim May" wrote in message
...
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






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default code help

It does a lot less, so less can go wrong. So I agree with Bob!

Bob Phillips wrote:

It is better IMO <vbg

--
HTH

Bob Phillips

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

"Jim May" wrote in message
...
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




--

Dave Peterson
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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
How to make a button VBA code reference other VBA code subroutines??? gunman[_9_] Excel Programming 4 September 27th 05 01:01 AM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM
option buttons run Click code when value is changed via VBA code neonangel Excel Programming 5 July 27th 04 08:32 AM


All times are GMT +1. The time now is 09:18 PM.

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"