Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBA code to edit a formula in excel?

I am trying to come up with some code that would take a formula and
edit to put in the ROUND function to round the result to 2 places.

Thank you for any ideas.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default VBA code to edit a formula in excel?

Take a look at this article in the archives:

http://groups.google.com/group/micro...browse_thread/
thread/a1c45338385e0fff/0afe4bc0c46218c8

In article .com,
wrote:

I am trying to come up with some code that would take a formula and
edit to put in the ROUND function to round the result to 2 places.

Thank you for any ideas.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA code to edit a formula in excel?

If having problems, try http://tinyurl.com/cxupr

--

HTH

RP
(remove nothere from the email address if mailing direct)


"JE McGimpsey" wrote in message
...
Take a look at this article in the archives:

http://groups.google.com/group/micro...browse_thread/
thread/a1c45338385e0fff/0afe4bc0c46218c8

In article .com,
wrote:

I am trying to come up with some code that would take a formula and
edit to put in the ROUND function to round the result to 2 places.

Thank you for any ideas.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default VBA code to edit a formula in excel?

Range("b1").Formula = "=round(" & Range("A1").Value & ",2)"

would take the value of a1 and round it to 2 places and put the result in b1

--


Gary


wrote in message
oups.com...
I am trying to come up with some code that would take a formula and
edit to put in the ROUND function to round the result to 2 places.

Thank you for any ideas.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBA code to edit a formula in excel?

Thanks Gary, it works on one enty, is there a way I can apply it to a
range of highlighted cells?

I tried the other reference given but I couldn't make it work.

Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default VBA code to edit a formula in excel?

see if this works for you

Option Explicit
Dim cell As Range
Sub RoundNumbers()
For Each cell In Selection
cell.Formula = "=round(" & cell.Value & ",2)"
Next
End Sub

--


Gary


wrote in message
oups.com...
Thanks Gary, it works on one enty, is there a way I can apply it to a
range of highlighted cells?

I tried the other reference given but I couldn't make it work.

Thanks



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
How do I view and edit the source code for a Chart in Excel 2003? EBB Charts and Charting in Excel 2 March 21st 07 08:16 PM
i edit a formula (excel) then it displays formula not answer caiman Excel Discussion (Misc queries) 2 September 9th 05 02:09 AM
edit formula bar in excel 2003? alnav89 New Users to Excel 1 April 27th 05 06:10 PM
Excel VBA macro - need to edit code to skip a year adun3434 Excel Programming 0 April 1st 04 09:14 PM
Code Edit Todd Huttenstine[_2_] Excel Programming 1 December 12th 03 03:34 AM


All times are GMT +1. The time now is 08:23 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"