View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
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