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. |
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. |
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. |
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. |
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 |
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 |
All times are GMT +1. The time now is 08:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com