Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I am working on a worksheet which has monthly payroll. I need to make a
macro which will go to the cell on the left, and remove a bracket in it and a multiplication function in it. For e.g. if A1 is =(221.86+1.15+3.75)*2, when i go to A2 I need the macro to remove the brackets and the *2 so the result in A2 should be =221.86+1.15+3.75. If I create the macro by keystrokes then wherever I am on the workshet I get the same result as A1. So I need to use vb but dont have a clue of the commands. Any help will be sincerely appreciated. Thankyou MS |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Sub ffixer()
Dim v As String Set r = Range("A1") v = r.Formula n = Len(v) - 3 v2 = Replace(Left(v, n), "(", "") r.Offset(1, 0).Formula = v2 End Sub -- Gary''s Student - gsnu200721 |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
MS
Select the range and run the code Sub test() For Each c In Selection If c.HasFormula Then f = c.Formula l = Len(f) f = Left(f, Len(f) - 3) f2 = Replace(Left(f, l), "(", "") Debug.Print f2 c.Formula = f2 End If Next End Sub Peter "MS" wrote: I am working on a worksheet which has monthly payroll. I need to make a macro which will go to the cell on the left, and remove a bracket in it and a multiplication function in it. For e.g. if A1 is =(221.86+1.15+3.75)*2, when i go to A2 I need the macro to remove the brackets and the *2 so the result in A2 should be =221.86+1.15+3.75. If I create the macro by keystrokes then wherever I am on the workshet I get the same result as A1. So I need to use vb but dont have a clue of the commands. Any help will be sincerely appreciated. Thankyou MS |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thank you for your help. It worked
Do appreciate it. Best wishes............MS "Billy Liddel" wrote: MS Select the range and run the code Sub test() For Each c In Selection If c.HasFormula Then f = c.Formula l = Len(f) f = Left(f, Len(f) - 3) f2 = Replace(Left(f, l), "(", "") Debug.Print f2 c.Formula = f2 End If Next End Sub Peter "MS" wrote: I am working on a worksheet which has monthly payroll. I need to make a macro which will go to the cell on the left, and remove a bracket in it and a multiplication function in it. For e.g. if A1 is =(221.86+1.15+3.75)*2, when i go to A2 I need the macro to remove the brackets and the *2 so the result in A2 should be =221.86+1.15+3.75. If I create the macro by keystrokes then wherever I am on the workshet I get the same result as A1. So I need to use vb but dont have a clue of the commands. Any help will be sincerely appreciated. Thankyou MS |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |