Removing "Round()" vba?

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I found a way to add "Round()" to a range of cells (https://www.mrexcel.com/forum/excel-questions/618276-add-round-function-all-cells.html). Then I discovered an error in the underlying formulas. I've now decided I need to learn VBA well enough to not have to ask for assistance. But until then ...

At any rate, can anyone share the code to undo the add-round-function-all-cells? If not, I'll go find my sledgehammer. :nya:

Thanks.

I am not here to give solution but rather to offer "unsolicited advice" - This also goes out for all NewBies (like me).
Always try out some tests in a copy -- never directly on your work, so you can prevent any unwanted things happening to your project. There are many good MVP's here, they can help you. Have you tried "UNDO"?
thank you..
 
Last edited:
Upvote 0
Have you tried
@LFKim.....the UNDO stack is cleared when a macro is activated, so Undo won't work !!

Code:
Sub add_round()
Dim rng As Range
    For Each rng In Selection
        rng.Value = "=[COLOR=RED]YOUR ORIGINAL FORMULA HERE[/COLOR]"
    Next rng
    
End Sub
 
Last edited:
Upvote 0
Have you tried
@LFKim.....the UNDO stack is cleared when a macro is activated, so Undo won't work !!

Code:
Sub add_round()
Dim rng As Range
    For Each rng In Selection
        rng.Value = "=[COLOR=RED]YOUR ORIGINAL FORMULA HERE[/COLOR]"
    Next rng
    
End Sub

Does that mean there is no way to undo?
if that's the case, Mr. rhoneyman, go get that sledgehammer! :(
 
Upvote 0
I found a way to add "Round()" to a range of cells (https://www.mrexcel.com/forum/excel-questions/618276-add-round-function-all-cells.html). Then I discovered an error in the underlying formulas. I've now decided I need to learn VBA well enough to not have to ask for assistance. But until then ...

At any rate, can anyone share the code to undo the add-round-function-all-cells? If not, I'll go find my sledgehammer. :nya:

Thanks.


maybe you can try this site:
https://support.office.com/en-us/ar...ice-file-169cb166-e7e2-438e-8f39-9a8927828121
 
Upvote 0
Did you try the code I posted by putting the original formula back into the code where noted...
 
Upvote 0
Mr. Michael M had suggested the following solution:
could be worth a try

Sub add_round()
Dim rng As Range
For Each rng In Selection
rng.Value = "=YOUR ORIGINAL FORMULA HERE"
Next rng

End Sub
 
Upvote 0
what is the original formula ??....and where does it reside ???
A couple of possibilities .....replace ALL the formula in the offending column via VBA !
OR
use another snippet of code to replace all the required values in the offending column !!
 
Upvote 0
Code:
Sub remove_round()
Dim rng As Range, cel As Range
On Error Resume Next
Set rng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
On Error GoTo 0
If rng Is Nothing Then Exit Sub
For Each cel In rng
    If Left(cel.Formula, 7) = "=ROUND(" Then _
        cel.Formula = "=" & Mid(cel.Formula, 8, Len(cel.Formula) - 10)
Next
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top