Simple Addition Macro Required

Learn&Prosper

New Member
Joined
Jan 13, 2012
Messages
32
Dear All

I want a selected range of cells to increase by the value of 7.
I know I can just copy 7 and do a paste special on these cells and add 7 to them but I want to know if I can highlight the range and run the macro to do this automatically.

You help would be appreciated.

Thanks :)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Code:
Sub Add7()
'assigned to 'Ctrl+s' macro shortcut key

Dim s As Range

For Each s In Selection
    s.Value = s.Value + 7
Next s

End Sub
 
Upvote 0
Hi

Thanks but its not working for me. I copied this into the Module and the control+S does not work. I am a newbie at excel macros so not sure where I need to put this in order for it to work. I can't see to link it to a button either.

Please help me as I can't see what I am doing wrong.

Thanks
 
Upvote 0
Hi

Thanks but its not working for me. I copied this into the Module and the control+S does not work. I am a newbie at excel macros so not sure where I need to put this in order for it to work. I can't see to link it to a button either.

Please help me as I can't see what I am doing wrong.

Thanks

From the Developer menu (Excel Options, Popular, Show Developer tab in the Ribbon), select Macros, highlight the Macro name, hit the Options button, and then assign a Shortcut Key of Ctrl+s.
 
Upvote 0

Forum statistics

Threads
1,214,824
Messages
6,121,784
Members
449,049
Latest member
greyangel23

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