John Snow
John Snow

Reputation: 5334

Auto increment decimal value in Excel

Im trying to figure out how to auto increment a decimal value in Excel, and for the next sheet increase the first number by one.

Example below:

(first sheet)
1.1
1.2
1.3
...
(second sheet)
2.1
2.2
2.3
...

Now if I add a new sheet I would like the numbering to continue with 3.1. Would something like this be possible in excel 2010?

Upvotes: 0

Views: 2098

Answers (1)

Mike Woodhouse
Mike Woodhouse

Reputation: 52316

I can't see any way to achieve this without some macro support. Something like the following might be a starting point; add it to the ThisWorkbook module in VBA:

Private Sub Workbook_NewSheet(ByVal Sh As Object)
    Sh.Cells(1, 1) = ThisWorkbook.Worksheets.Count + 0.1
End Sub

The code is called when a new worksheet is created, receiving the new sheet as a parameter. Then the top-left cell is supplied with a value reflecting the number of sheets currently in the workbook, plus 0.1 as in the question. Further cells may be filled with (say) a For loop as required (it's not clear from the question exactly how many cells should get a value or by what rule we'd know that).

Upvotes: 2

Related Questions