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

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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
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
Help with MACRO to Edit WORKDAY Formula? Wart Excel Discussion (Misc queries) 2 April 25th 08 10:36 PM
Macro to edit formula Tang123 Excel Discussion (Misc queries) 2 October 6th 05 08:33 PM
MACRO TO EDIT CELL FORMULA !! jay dean Excel Programming 3 July 10th 04 04:05 PM
macro to edit formula steve Excel Programming 0 August 20th 03 11:45 PM
macro to edit formula Steve d'Apollonia Excel Programming 4 August 20th 03 09:41 PM


All times are GMT +1. The time now is 10:17 AM.

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"