Need Help with Simple Macro

RichHearn

New Member
Joined
Sep 24, 2011
Messages
2
Hi All,

I am trying to create a macro where users selects a cell or multiple cells ( in my case all the cells are located in one column) and increase all the selected cell values by a user defined amount.

For example

I have 5 tools ( t1, t2, t3...) all located in column A1:A5. A person uses tool 2 and tool 4 for 3 hours. So the user can enter 3 in a separate cell and then select t2 and t4 and click compute and the total hours on tool 2 and tool 4 increases by 3 hours.

I realize that it could be done with a simple filter column but this process is completed so many time that even a simple one or two minute saving would amount to a big deal over time.

Thanks in advance for your help
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try this

Code:
Sub Increase()
Dim h As Variant, r As Range, c As Range
h = Application.InputBox("Enter hours", Type:=1)
If h = False Then Exit Sub
On Error Resume Next
Set r = Application.InputBox("Select the cells", Type:=8)
On Error GoTo 0
If r Is Nothing Then Exit Sub
For Each c In r
    c.Value = c.Value + h
Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,522
Members
452,923
Latest member
JackiG

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