Increase/Decrease cells value

brooklyn2007

Board Regular
Joined
Nov 20, 2010
Messages
143
Hi,

I have a sheet with data table. I need to have a macro to increase or decrease by % the values of the cells I select. Also the numbers after the execution have to be rounded, no decimals. Is there any way please?
 

Attachments

  • 123.jpg
    123.jpg
    60.3 KB · Views: 15

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
So you may select more than 1 cell, right? So where is the value that you would be increasing or decreasing by located?
 
Upvote 0
Hi,

Already resolved the main part of the code. Now I need to round up numbers (in full, no decimals) after the results. How do I add the round function please to the code below? It has to work for cells range D3:W5000

Private Sub CommandButton1_Click()
Dim Num As Variant

Num = InputBox("Put value", "Percent to change", 0)
If Num = "" Or Not IsNumeric(Num) Then Exit Sub
With Range("D3:W5000")
.Value = Evaluate(Replace("if(@="""","""",@*" & Num & ")", "@", .Address))
End With
End Sub
 
Upvote 0
How about
VBA Code:
.Value = Evaluate(Replace("if(@="""","""",roundup(@*" & Num & ",0))", "@", .Address))
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,565
Messages
6,114,337
Members
448,568
Latest member
Honeymonster123

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