View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 576
Default Changing cell formulas with a macro or VBA

This worked in Excel97

Sub myformula()
' Keyboard Shortcut: Ctrl+q

ActiveCell.Formula = "=round(" & Right(ActiveCell.Formula,
Len(ActiveCell.Formula) - 1) & ",0)"
End Sub

watch word wrap
change 'q' to your choice.

--
sb
"JDeBeer" wrote in message
om...
Have a co-worker that wants to change the formulas in his spreadsheet
to add "=round(" to the front and ",0" to the end. Formulas may be
long or short and there are plenty of them.

He would like a simple macro so he could activate a cell, and hit the
shortcut keys, and make the conversion.

Thanks for any help.