Macro to edit a formula.
This seemed to work ok for me:
Option Explicit
Sub testme01()
Dim myRng As Range
Dim myCell As Range
Set myRng = Selection
For Each myCell In myRng.Cells
With myCell
If .HasFormula Then
.Formula = "=round((" & Mid(.Formula, 2) & ")/1.08,2)"
Else
.Formula = "=round(" & .Value & "/1.08,2)"
End If
End With
Next myCell
End Sub
Select your range and test it out. It does all the cells that are selected.
jimwood wrote:
I have an old lotus macro that I would like to reproduce in excel.
Specifically I would like to have a macro open a cell in an edit mode and
have the cell be a formula of =round(/1.08,2) with the cursor sitting
just in front of the division sign so that someone could enter a number and
have it divide by 1.08. I and a coworker have been trying all sorts of
things but none of them are working.
--
Thanks,
Jim
--
Dave Peterson
|