Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Incrementing numbers in a column

Can someone help me? I am looking for a formula or macro to increment
numbers in a column such that when a number is entered in an empty cell,
the remaining numbers (in the column) are incremented by 1. In the examples
below, the Before example represents a spreadsheet with numbers in certain
cells in Column A.

The After example represents placing a number in an empty cell (A3) and the
remaining numbers in the column are incremented by 1.

Before
|COL A
1|1
2|
3|
4|2
5|
6|3
7|
8|4
9|
10|5


After
|COL A
1|1
2|
3|2
4|3
5|
6|4
7|
8|5
9|
10|6

(I would like this formula/macro to be in effect for all of Column A.)

Thanks In Advance!
--
Rodman Veney
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Incrementing numbers in a column

In your Sheet Module paste in:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
If Application.Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
Application.EnableEvents = False
lrow = Cells(Rows.Count, "A").End(xlUp).Row
Set Rng = Range(Cells(Target.Row + 1, Target.Column), Cells(lrow, 1))
For Each cell In Rng
If cell < "" Then
cell.Value = cell.Value + 1
End If
Next cell
Application.EnableEvents = True
End Sub

"Rodman" wrote:

Can someone help me? I am looking for a formula or macro to increment
numbers in a column such that when a number is entered in an empty cell,
the remaining numbers (in the column) are incremented by 1. In the examples
below, the Before example represents a spreadsheet with numbers in certain
cells in Column A.

The After example represents placing a number in an empty cell (A3) and the
remaining numbers in the column are incremented by 1.

Before
|COL A
1|1
2|
3|
4|2
5|
6|3
7|
8|4
9|
10|5


After
|COL A
1|1
2|
3|2
4|3
5|
6|4
7|
8|5
9|
10|6

(I would like this formula/macro to be in effect for all of Column A.)

Thanks In Advance!
--
Rodman Veney

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Incrementing numbers in cells Andrew Morine Excel Worksheet Functions 1 August 26th 08 02:11 AM
incrementing account numbers John Excel Discussion (Misc queries) 5 March 10th 06 02:44 PM
Incrementing numbers Floyd107 Excel Worksheet Functions 2 February 28th 06 10:04 AM
Table of incrementing by one numbers brbarto New Users to Excel 2 December 20th 05 03:16 AM
Incrementing Cell Numbers Lance W. Grimes Excel Discussion (Misc queries) 1 March 8th 05 07:51 PM


All times are GMT +1. The time now is 11:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"