"add one" Macro

mccornack

New Member
Joined
Sep 26, 2011
Messages
6
I have a project I'm working on for work, and it would be fantastic if I could select a cell or a range of cells, hit a hot key, and have that cell or set of cells increase by 1. Is there a way to set up a macro, or write some piece of VBA code to achieve this? I spent more time today trying to teach myself how to record and execute macros than I did on my actual project. Any help would be greatly appreciated!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Select the cell or cells that you want to add one to (text and blank cells will be ignored) and give this macro a try...

Code:
Sub AddOne()
  Dim Cell As Range
  On Error Resume Next
  For Each Cell In Selection
    If Len(Cell.Value) Then Cell.Value = Cell.Value + 1
  Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,278
Members
452,902
Latest member
Knuddeluff

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