Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Creating a macro to add a number to another number?

I want to create a button in Excel with a macro that allows me to add 5 to another number.

So for example, I could click any cell with a value in it, then click the button and 5 would be added to the value in the cell. I've tried various formulas and paste special with no success, so how can I do it?

Update:

Cheers, I'll do it now.

1 Answer

Relevance
  • ?
    Lv 4
    9 years ago
    Favorite Answer

    Sub add5()

    If IsNumeric(ActiveCell) Then

    ActiveCell = ActiveCell + 5

    End If

    End Sub

    With Excel open, press ALT+F11. Click Insert, then select Module. Paste the above code. Close the VBA window. Right-click on the button and assign the macro to it.

Still have questions? Get your answers by asking now.